I am hitting an API using requests library in Django inside a celery task. To be very specific, it fetches some record from database, prepares a json and does a POST request. In the certain case scenario, the call fails with 500 error code. I want to retry the POST request again. What's the best way to go about it and why?
- Retry the Celery task itself (See implementation)
- Retry the request using
urllib.util.retry(See full implementation)