I'm trying to list the title and number on a pull request in a repository. I would like to return the JSON as a dict and print the title and number of the pull request.
If I just print the title or number alone, I get the expected output, but if combine the values to print, I get TypeError: string indices must be integers
.
#!/usr/bin/env python
import github3
from github3 import login, GitHub
import requests
import json
import sys
auth = dict(username="xxxxxxxxx",token="xxxxxxxxx")
gh = login(**auth)
result = gh.repository(owner="xxx", repository="xxxx").pull_request(x)
data = result.as_dict()
print data['title']['number']