0

While using the GitHub Search API, some queries are incomplete. For instance, this one -

import requests

url = "https://api.github.com/search/code?q=torch +in:file + language:python&page=1&per_page=100"

headers = {
'Authorization': 'Token XXXXXXXXXXXXXXXXX'
}

response = requests.request("GET", url, headers=headers).json()
try:
    print(len(response['items']))
    print("response = ", response)
except:
    print("response = ", response)

*Note - The above code won't work as I have removed my token. Please replace the "xxx" with your GitHub token if you'd like to run the code.

This rarely returns 100 results. From previous SO posts, I understand this is due to the query timing out. However, in that case as per GitHub documentation, the returned result should indicate that the results are incomplete -

response =  {'total_count': 6872903, 'incomplete_results': False, 'items' ...

Why is incomplete_results not set to True over here?

desert_ranger
  • 1,096
  • 3
  • 13
  • 26

0 Answers0