# 时间 12:08
# "expires_in": 171205,
import requests
import json
from datetime import datetime
import time
url = "https://jywgappthw.chinatowercom.cn:9000/workorder/bill/getBillList/"
headers = {
"Authorization": "Bearer 8758805f-cf24-4e43-ad8c-a661e76c206f",
"User-Agent": "Mozilla/5.0 (Linux; Android 11; 2112123AC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.131 Mobile Safari/537.36 uni-app Html5Plus/1.0 (Immersed/24.0)",
"Content-Type": "application/json",
}
payload = {
"userId": "91c7750eadc144948ba558fc367c9c8d",
"roleId": "0100070",
"billType": "ACCEPT",
"pageNumber": 1,
"pageSize": 10,
"billStatus": "",
"areaId": "",
"businessType": "",
"beginTimeType": "",
"cityId": "",
"provId": "",
"stationCode": "",
"stationName": "",
"deviceName": "",
"deviceCode": "",
"billSn": ""
}
while True:
# Making the POST request
response = requests.post(url, headers=headers, json=payload)
# Writing response to a file
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
with open("C://1.txt", "w") as file:
file.write(f"Response Time: {timestamp}\n\n")
file.write(f"Response Headers:\n{json.dumps(dict(response.headers), indent=2)}\n\n")
file.write(f"Response Body:\n{json.dumps(response.json(), indent=2)}")
# Introduce a delay (1 minute in this example)
time.sleep(60)