I’m currently using the GitHub REST API and I’m facing an unusual issue. Every time I attempt to search for code, I receive rate limit exceeded errors, even though I still have several requests available.
Here’s the code I’m working with:
import requests
url = 'https://api.github.com/search/code?q=flask+in:file+language:python'
result = requests.get(url, headers=headers)
The error response I get is:
{
"message": "API rate limit exceeded for ... (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) If you reach out to GitHub Support for help, please include the request ID ... and timestamp 2025-06-26 19:56:09 UTC.",
"documentation_url": "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api",
"status": "403"
}
I am using a personal access token in my Authorization header, and checking my rate limits shows I have 60 requests remaining. This situation is confusing for me. Why does GitHub report that I’ve surpassed the limit when I still have requests left? Is there a specific aspect of the search API that I might not be aware of? Any assistance with resolving this would be highly appreciated.