我尝试使用下面的python代码,使用api“rubinius”获取项目的贡献者
代码是:

import json, requests
all_contributors = list()
page_count = 1
while True:
    contributors = requests.get("https://api.github.com/repos/rubinius/rubinius/contributors?page=%d"%page_count)
    if contributors != None and contributors.status_code == 200 and len(contributors.json()) > 0:
        all_contributors = all_contributors + contributors.json()
    else:
        break
    page_count = page_count + 1
count=len(all_contributors)
print("-------------------%d" %count)

总贡献者是349,在网站上,总贡献者是408,请问我的程序哪里有问题?
谢谢

最佳答案

有些投稿人是匿名的。所以考虑设置?anon=1参数
docs

关于python - 如何在Github中获得项目的总贡献者,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42466421/

10-13 06:36