我想更新拉取请求的标题并执行以下操作来实现它: - (遵循此文档https://developer.github.com/v3/pulls/#update-a-pull-request)
data = {“title”:“新标题”}
URL = 'https://hostname/api/v3/repos/owner/repo/pulls/80'
token ='my-token'
headers = {'Content-type':'application / json','Accept':'application / json','Authorization':'token%s'%token}
resp = requests.patch(url,data = json.dumps(data),headers = headers)
print resp.json()
我错过了什么?请帮忙。
答案 0 :(得分:1)
以下对我有用:
import requests
token = "my-token"
url = "https://api.github.com/repos/:owner/:repo/pulls/:number"
payload = {
"title": "New title"
}
r = requests.patch(url, auth=("username", token), json=payload)
print r.json()