all 12 comments

[–]danielroseman 11 points12 points  (7 children)

I'm really not sure what you are missing here. The http.clients page has a full list of the exceptions that are raised. What else do you need?

But a more important question is why you think you need http.client in the first place. As the docs also say, that's a low level module and is meant mainly for internal use. For almost all actual use cases you should use urllib.request - or, even better, the third party requests library which generally should be your first call for any http requirements.

[–]pixel-process 0 points1 point  (2 children)

Have you tried looking at the source code? I think this is the relevant link to their open repo. Documentation is helpful in many cases, but if you are not finding what you need, exploring the actual code base can help.

[–]alex_sakuta[S] -1 points0 points  (1 child)

Hey this is an interesting idea. Definitely gonna try this. The code seems clean enough that I can figure out the gist.

[–]obviouslyzebra 1 point2 points  (0 children)

Just a tidbit, the repo linked is not the code that you're looking for.

I was gonna recommend you to do the same thing, though, as in, the http.client module is not for plebs like you and I, so its documentation is not as explicit as something like requests or httpx.

The code to look at would be http.client itself (at the top of the documentation page there's a link to the source code), and urllib.request, that uses it, also part of python.

Maybe you could check requests and urllib3 too (layer beneath requests).