Add ability to configure max retries for v1.1 server errors#670
Add ability to configure max retries for v1.1 server errors#670betsybookwyrm wants to merge 1 commit intomainfrom
Conversation
Given the increasing instability of the v1.1 API, it's helpful to be able to tune the number of retries for server errors. - Adds max_server_error_retries param to the v1.1 client retaining old value of 30 as default value - Pass max_server_error_retries through the rate_limit decorator - Pass max_server_error_retries through uses of Twarc.get() in client.py
|
This looks good to me! Thanks! Definitely useful to have, even though v1.1 is slowly being deprecated - i think because of staff cuts at twitter v1.1 may live for a while much longer. The places where |
|
👍 For your questions:
Yes, this is consistent with the others http and connection error configurable settings. The implementation is fine, but it would be a little cleaner to inject the
I'd be happy to merge without that, I suspect most adhoc CLI usage has already migrated to V2.
utils can stay as they are with the defaults, I don't think it's worth trying to customise anything supporting v1.1 right now. |
Hmm. I did look at ways of getting it directly in rather than passing it through, but as it's more the rate_limit decorator that needs it and rate_limit doesn't know anything about the Twarc object in the end I thought it was simpler and clearer to pass it through the calls to the function. But I can keep playing with it if you like - it is definitely a bit of a pain to have to add it to all the calls of the functions that use the rate_limit decorator. |
Given the increasing instability of the v1.1 API, it's helpful to be able to tune the number of retries for server errors.
Given I haven't consulted with anyone on this change, please let me know what you think and I'm very happy to alter it!
Some questions I have for you all:
For further context, I'm suggesting this change because we're seeing an increasing number of 500 errors returned from the v1.1 timeline endpoint, which is not surprising given everything that's going on at Twitter. For my usage of the endpoint, I'd much rather skip over that request earlier and move on to my next request - we are finding some requests do reach the 30 retries! I'd imagine that other people may want to retry for longer to increase their chances of getting the data they want.