Rest API - Webhooks and Events
You want to implement exponential backoff retry for a REST API call in Python. Which approach correctly applies this?
import time
for i in range(4):
response = requests.get('https://api.example.com')
if response.status_code == 200:
print('Success')
break
else:
time.sleep(2 ** i)
else:
print('Failed after retries')
