I have a few lambda functions which is making mutliple AWS Elastic beanstalk API Call written in python. It was working fine. but since last few days we are getting Throttling error. After discussion with AWS, they have told to add exponential back-off logic in code. So if it's throttle, will retry same API Call on incremental interval. I got what they are saying and how it works, but i don't understand how to add in my code. They have documentation for CLI but they don't have for APIs as follow,http://docs.aws.amazon.com/general/latest/gr/api-retries.html
can someone please give me simple example how can we map response of API Call and retry if it's throttle like my one api call i am using in my code as below,
import boto3
conn = boto3.client('elasticbeanstalk')
response = conn.describe_environments(EnvironmentNames=["xyz"])
return response
I know simple way to do it with if condition, by checking response is "Rate exceeded" using while do i think i can achieve this. but i want to check as provided in example of CLI, how can i do similar for API?
Any help would be appreciated!