I am a newer programmer and I am trying to call the Github API to get a list of the most starred python projects, ordered by number of stars. Every time I run the program, rerunning the request, I am never getting the same result. Throwing everything into a dataframe and sorting by number of stars, every run of the program is giving me a different number. I’m not sure if I am doing something wrong with my code or not understanding the github api.
```
query_url = "https://api.github.com/search/repositories?q=language:python&sort=stars&order=desc"
headers = {'Authorization': f'token {API_KEY}'}
r = requests.get(query_url, headers=headers)
result = r.json() # pprint(r.json())
```
2
Answers
Problem: Pagination
Solution: Sort through all pages Code:
how about if using pagination and breaking it down into several pages? i think the Github API there’s a parameter to achieve this using
per_page
andpage
parameters such as :