如何提取开发人员在GitHub pull request的统一差异部分中提供的GitHub pull request注释?我想创建一个带有注释的csv文件进行分析。
url ='https://api.github.com/search/repositories?q=language:java&sort=forks&order=desc&per_page=10&page=1'
resp = urllib.request.urlopen(urllib.request.Request(url))。read()。decode('UTF-8')
json_obj = json.loads(resp_text)
用于json_obj ['items']中的回购:
# j is the current page number
for j in range(1, 11):
url = 'https://api.github.com/repos/' + repo['owner']['login'] + '/' + repo['name'] + '/pulls/comments?direction=desc&per_page=10&page=' + str(j) + '&access_token=' + github_access_token
json_obj = json.loads(urllib.request.urlopen(urllib.request.Request(url)).read().decode('UTF-8'))
# save json to csv
for data in json_obj:
csvwriter.writerow(data['body'])
rdata.close()
我想从前10个存储库中检索请求请求评论注释正文(必填文本),并保存在CSV文件中。