I am using the StackAPI library for Python to access Stack Overflow questions. I need to collect all question IDs attached with a particular tag (for example, regex).
I used the search bar on Stack Overflow with the query [regex]
. The Stack Overflow search engine indicated that there are 725,098 questions.
With StackAPI, I set the page_size
to 100 and max_pages
to 7251. Since I have an API key, my quota is 10000 per day. When I run the code, it throws an error code for throttle violation. I am not sure why.
Note: I am using a custom filter with back_off checked.
throttle
? Note: even if you obey thethrottle
you need to handle all other types of responses from the SE API, as the responses which the SE API give are undefined under common circumstances (e.g. when your IP is temporarily blocked/throttled, which is related to but separate from athrottle
response).remaining_quota
over 9000, setting themax_pages
to less than should technically obey the throttle. Unless I didn't account for anything else on top of the number of pages.has_more
is true andremaining_quota
is over 100