Hey! For python requests retry, I’ve been using `requests.Session` with a custom retry strategy.
Here’s what I do:
```python
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[500, 502, 503, 504]
)
adapter = HTTPAdapter(max_retries=retry_strategy)
session = requests.Session()
session.mount("https://", adapter)
```
This handles most server-side issues, and I add a timeout to avoid hanging forever.
Here’s what I do:
```python
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[500, 502, 503, 504]
)
adapter = HTTPAdapter(max_retries=retry_strategy)
session = requests.Session()
session.mount("https://", adapter)
```
This handles most server-side issues, and I add a timeout to avoid hanging forever.
