我正在尝试在存储库中列出拉取请求的标题和编号。我想将 JSON 作为字典返回并打印拉取请求的标题和编号。
如果我只打印标题或编号,我会得到预期的输出,但如果将这些值组合起来打印,我会得到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']