Requests retry status_forcelist is worked when 404 is occured, but shows no "retrying" logs

Hello everyone I want to ask, I have 2 webserver called it `172.10.10.1:8080` and `172.10.10.2:8080` that serve a static object like (image, gif, video).

But sometimes it occurs `404` from the server side, here's the example using `curl`

Try number 1
```
curl -I http://172.10.10.1:8080/image_1.jpg
HTTP/1.1 404 Not Found
Server: nginx/1.16.1
Date: Mon, 25 Apr 2022 16:28:27 GMT
Content-Length: 25
Connection: keep-alive
```

Try number 2
```
curl -I http://172.10.10.1:8080/image_1.jpg
HTTP/1.1 404 Not Found
Server: nginx/1.16.1
Date: Mon, 25 Apr 2022 16:28:27 GMT
Content-Length: 25
Connection: keep-alive
```


Try number 3
```
curl -I http://172.10.10.1:8080/image_1.jpg
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Mon, 25 Apr 2022 16:29:24 GMT
Content-Length: 125330
Connection: keep-alive
Last-Modified: Fri, 15 Nov 2013 22:17:36 GMT
Accept-Ranges: bytes
```

To handle the issue I have to use the `retry` mechanism, here's the code example

```
def retry_session(retries=5, backoff_factor=0.3, session=None, status_forcelist=[404, 500, 502, 503, 504]):                                                   
    '''                                                                                                                                                       
    Retry mechanism                                                                                                                                           
     - {backoff factor} * (2 ** ({number of total retries} - 1))                                                                                              
    '''                                                                                                                                                       
    session = session or requests.Session()                                                                                                                   
    retries = Retry(                                                                                                                                          
        total=retries,                                                                                                                                        
        backoff_factor=backoff_factor,                                                                                                                        
        allowed_methods=["HEAD", "GET"],                                                                                                                      
        status_forcelist=status_forcelist                                                                                                                     
    )                                                                                                                                                         
    session.mount('http://', HTTPAdapter(max_retries=retries))                                                                                                
    return session
```

And here's my question

**Why if I remove the `404` from the status_forcelist sometimes it shows  except requests.exceptions.HTTPError, but if I add it on status_forcelist it shows no retrying logs and the requests is success?**

Thank you.

Hi @muhammad-asn, this appears to be a request for assistance. The Retry object is handled by urllib3 and you can find the documentation [here](https://urllib3.readthedocs.io/en/1.26.9/reference/urllib3.util.html). Requests will throw an HTTPError if the final output from the response has an issue. That would mean there's something else wrong with the 404 response unless you're calling `raise_for_status` and the Retry is avoiding that code path by waiting for the 200.

This is a question better handled for StackOverflow though as stated in the issue template.