简体   繁体   中英

GitHub API to list repositories of an user does not list all repositories

I'm working on a data analysis tool in Python just for fun and I wanted to find out the amount of code in bytes written in every language by a user or an organisation.

The script is working fine but the problem is that the GitHub API endpoint outputs only around 30 repositories on both authenticated and non authenticated requests.

For example the endpoint https://api.github.com/users/google/repos outputs 29 repository json objects and https://api.github.com/orgs/google/repos outputs 26 json objects.

Obviously google has much more repositories than that, so how can I access them? I just want to get the URL of the repository for my script.

Any ideas?

https://api.github.com/orgs/google/repos returns 30 repositories for me, and that's expected behavior. The GitHub API won't return the full list of items in a single response. Instead, the list will be paginated and you can fetch additional pages using the approach described here:

https://developer.github.com/v3/#pagination

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM