Skip to content

Instantly share code, notes, and snippets.

View anibalpacheco's full-sized avatar

Aníbal Pacheco anibalpacheco

View GitHub Profile
@anibalpacheco
anibalpacheco / mp.py
Last active August 5, 2021 15:57
Solution to 429 errors in mercadoago test API
# tldr: Retry the request until you got a non-error response.
# In my own experience, in less than 40 attempts you can get a non-error response.
# For the customer API (Python):
response = api_call(...)['response']
response_status = response.get('status')
attempts = 0
while response_status == 429 and attempts < max_attempts:
response = api_call(...)['response']