-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
The documentation lists a relatively small list of exceptions, among them:
exception
requests.URLRequired(*args, **kwargs)
A valid URL is required to make a request.
which would imply that passing an invalid URL raises URLRequired. However, that exception is actually dead code and not raised anywhere ever since ab27027 in 2012. Instead, with requests 2.32.3, invalid URLs raise something like MissingSchema, InvalidSchema or InvalidURL, none of which are documented.
Looking at exceptions.py, there seem to be various other undocumented exceptions in there:
class InvalidJSONError(RequestException):(onlyJSONDecodeErrorwhich inherits from it)class ProxyError(ConnectionError):class SSLError(ConnectionError):class ConnectTimeout(ConnectionError, Timeout):(Timeoutis documented)class ReadTimeout(Timeout):(Timeoutis documented)class MissingSchema(RequestException, ValueError):class InvalidSchema(RequestException, ValueError):class InvalidURL(RequestException, ValueError):class InvalidHeader(RequestException, ValueError):class InvalidProxyURL(InvalidURL):class ChunkedEncodingError(RequestException):class ContentDecodingError(RequestException, BaseHTTPError):class StreamConsumedError(RequestException, TypeError):class RetryError(RequestException):class UnrewindableBodyError(RequestException):
(Some of those might be internal, or considered not worth documenting since they can be caught by except ValueError:. However, even e.g. Errors and Exceptions or the reference docs don't seem to point out that either.