1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-06 14:52:50 +08:00
Files
xiaomusic/plugins/httppost.py
2025-02-18 21:45:45 +08:00

14 lines
410 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import requests
target = "HTTP://192.168.1.10:58091/items/"
def httppost(data, url=target):
global log
# 发起请求,
with requests.post(
url, json=data, timeout=5
) as response: # 增加超时以避免长时间挂起
response.raise_for_status() # 如果响应不是200引发HTTPError异常
log.info(f"httppost url:{url} data :{data} response:{response.text}")