reposync/issue_sync/update_github_issue.py

32 lines
692 B
Python
Raw Permalink 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
import json
# 你的GitHub用户名或用于认证的token
# 注意出于安全考虑通常不建议在代码中硬编码密码而是使用token
# 你的仓库信息
owner = 'fuxingtamu'
repo = 'yundingzhiyi'
# GitHub创建issue的API URL
url = f"https://api.github.com/repos/fuxingtamu/yundingzhiyi/issues/255"
# 构造请求头
token = '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'
# 构造请求头
headers = {
'Authorization': f'token {token}',
'Accept': 'application/vnd.github+json'
}
# 发送POST请求
data = {
"state":'open'
}
response = requests.patch(url, headers=headers, json=data,verify=False)
# 打印响应
print(response.text)