使用说明:链接
右上角登录,获取SendKey
python
# pip install serverchan-sdk
# 使用库
from serverchan_sdk import sc_send;
response = sc_send("sendkey", "title", "desp", {"tags": "服务器报警|图片"})
print(response)
python
#直接使用函数
def sc_send(sendkey, title, desp='', options=None):
if options is None:
options = {}
if sendkey.startswith('sctp'):
match = re.match(r'^sctp(\d+)t', sendkey)
if match:
url = f'https://{match.group(1)}.push.ft07.com/send/{sendkey}.send'
else:
raise ValueError("Invalid sendkey format for 'sctp'.")
else:
url = f'https://sctapi.ftqq.com/{sendkey}.send'
params = {
'title': title,
'desp': desp,
**options
}
headers = {
'Content-Type': 'application/json;charset=utf-8'
}
response = requests.post(url, json=params, headers=headers)
result = response.json()
return result
sc_send("填写自己的token", "修改自己的标题", msg, {"tags": "标签分类"})