403 Error while using the REST API for code search #48931
Replies: 1 comment
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hello, I am attempting to do some code search for multiple keywords, but I keep getting a 403 error that I can't figure out. My understanding of the API is that it will return a max of 100 results per page and authenticated requests are limited to 30 per minute.
My search result set is larger than 100, so I have to page through the results. I have three query strings to do this for.
For query_string_0, I get 100 results and save them to a dataframe. Then I get the next 100 results and concatenate dataframes. I continue this in a while loop until no more results are returned. Finally, I follow this same process for query_string_1 and query_string_2, all while concatenating into a single dataframe.
Sometimes I get the 403 while on page=2 of query_string_0, sometimes I get it while on page=6 of query_string_0. I'm checking the rate limit endpoint each time and haven't hit my limits. Would greatly appreciate any help to figure out what could be causing this. Thanks!
I've included my full code below as well as a picture of my debugging output.
Beta Was this translation helpful? Give feedback.
All reactions