如何通过 Github API 更新拉取请求

How to update a pull request through Github API

我想更新拉取请求的标题并执行以下操作来实现它:-(遵循此文档 https://developer.github.com/v3/pulls/#update-a-pull-request

data = {"title": "New 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()

我错过了什么?请帮忙。

以下对我有用:

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()