Request is throttled and retry via decorator #134
Replies: 7 comments
-
I have these working by using the Tenacity library, works a treat. We have discussed including this functionality in the library but we've not got there yet. |
Beta Was this translation helpful? Give feedback.
-
This seems a very important feature to make this library useful. I would not be able to use it without adding this retry logic. Can you add this into your feature list to be implemented? Thanks |
Beta Was this translation helpful? Give feedback.
-
@threemonks my original issue is #37 However, I closed this as the tenacity library did this in a fantastic way and was something else for us to not have to support. Have you checked the tenacity library out ? I can show you an example of my current working setup if you would like ? |
Beta Was this translation helpful? Give feedback.
-
Yes, that would be much appreciated. |
Beta Was this translation helpful? Give feedback.
-
looks like I've already done it in #37 let me know if you need more help with that |
Beta Was this translation helpful? Give feedback.
-
Thanks. That seems would require me to create a wrapper function for each API call that could be throttled, and apply the decorator to each such wrapper function? That is doable, but would be cleaner and nicer if the throttle is built into the library code as throttling happens in almost all MWS API calls. |
Beta Was this translation helpful? Give feedback.
-
Correct, you would need to wrap the API call in the tenacity decorator, but its quite easy to extract the calls from the code. For including this in the library, as I said it has been mooted but there are other more pressing priorities first |
Beta Was this translation helpful? Give feedback.
-
Is it possible for the make_request or MWS API call methods like Finances.list_financial_events to handle MWS throttle error?
In the old versions, I was able to wrap methods like Orders.list_orders with a decorator that retries when it catches a throttled condition, and retry certain times with increasing pause in between. But now with this new implementation of deprecating Finances.list_financial_events_by_next_token and replace it with
Adding a retry logic via decorator does not seem to work anymore. Maybe due to how my decorator works and interfere with the decorator @utils.next_token_action('ListFinancialEvents')?
I used the decorator from this url with some minor change:
https://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions