We can repeat the request when any error code occurs, for example :
import requests
from requests.adapters import HTTPAdapter, Retry
s = requests.Session()
retries = Retry(total=5, backoff_factor=0.1, status_forcelist=[ 500, 502, 503, 504 ])
s.mount('http://', HTTPAdapter(max_retries=retries))
But how to implement resending a request when an exception occurs, for example - requests.exceptions.ProxyError ?