AS_ON
AS_ON

Reputation: 173

How to update a pull request through Github API

I want to update the title of a pull request and performing the below to achieve it :- (followed this doc 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()

What am I missing ? Please help.

Upvotes: 2

Views: 2806

Answers (1)

Wilhelm Klopp
Wilhelm Klopp

Reputation: 5460

The following worked for me:

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

Upvotes: 1

Related Questions