| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import httpx
- # base_url_list = [
- # "http://192.168.31.201:58001",
- # "http://192.168.31.201:58002",
- # "http://192.168.31.201:58003",
- # "http://192.168.31.201:58004",
- # "http://192.168.31.201:58005",
- # "http://192.168.31.201:58006",
- # "http://192.168.31.201:58007",
- # "http://192.168.31.201:58008",
- # "http://192.168.31.201:58009",
- # "http://192.168.31.201:58010",
- # ]
- base_url_list = [
- "http://192.168.64.32:58001",
- "http://192.168.64.32:58002",
- "http://192.168.64.32:58003",
- "http://192.168.64.32:58004",
- "http://192.168.64.32:58005",
- "http://192.168.64.32:58006",
- "http://192.168.64.32:58007",
- "http://192.168.64.32:58008",
- "http://192.168.64.32:58009",
- "http://192.168.64.32:58010",
- "http://192.168.64.32:58011",
- "http://192.168.64.32:58012",
- ]
- for base_url in base_url_list:
- key = "/api/configs"
- url = base_url + key
- headers = {
- "accept": "application/json, text/plain, */*",
- "accept-encoding": "gzip, deflate, br, zstd",
- "accept-language": "zh-CN,zh",
- "connection": "keep-alive",
- "content-type": "application/json",
- "host": "localhost:17888",
- "origin": base_url,
- "referer": base_url,
- "sec-ch-ua": '"Not A(Brand";v="8", "Chromium";v="132", "Brave";v="132"',
- "sec-ch-ua-mobile": "?0",
- "sec-ch-ua-platform": '"macOS"',
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-origin",
- "sec-gpc": "1",
- "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
- }
- # 请求体数据
- data = {"mode": "Global"} # 替换为实际的请求数据
- # 使用 httpx 发送 PATCH 请求
- try:
- with httpx.Client() as client:
- response = client.patch(url, headers=headers, json=data)
- if response.status_code == 204:
- print(f"{url} OK")
- else:
- print("响应内容:", response.text)
- except httpx.RequestError as exc:
- print(f"请求失败: {exc}")
|