软件编程 --- 发http包
  Qw9CIfGfUZoX 2023年12月01日 34 0

 

# 时间 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)

 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年12月01日 0

暂无评论

推荐阅读
  tqf4faUYHHCA   2023年12月23日   94   0   0 sedpythonPythonsed
Qw9CIfGfUZoX