requests
requests copied to clipboard
Document which exceptions request() might raise
Ask to document which exceptions request() might raise
I notice that the .json function documents that it might raise a JSONDecodeError. This is very helpful for writing comprehensive error handling code around requests. I'm asking for that to be done for the main interface as well.
While a list of exceptions is provided in the documentation, it is not clear which exceptions will be returned by which methods. For example I don't think JSONDecodeError can be raised by .get. I tried to read the requests code to get a sense of which might be thrown from it, but it is a little challenging to follow as a first time reader.
As a newcomer to this project, I'm eager to contribute and address the mentioned issue. I'd like to inquire about the exceptions list mentioned in the documentation—is it exhaustive and does it encompass all possible exceptions? If so, I'm prepared to work on enhancing the documentation. My proposal is to not only update the main interface but also extend the coverage to other methods, aiming for consistency similar to what is currently done for the .json() function.
That would lead to a lot of code duplication in my opinion, apart from requests.ReadTimeout and requests.JSONDecodeError , all request methods return an instance of the Response object, which can raise the same exceptions.
I want to solve this issue @mjperrone , if this issue is still opened and kindly assign me this issue and provide me necessary required information