Skip to content
Myr

Merge pull request #512 from silent1mezzo/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Adds MissingSchema and InvalidSchema Exceptions

authored by Kenneth Reitz · committed by Kenneth Reitz · parents afb1bd1, d24ee0e · Browse files · 2 files+9 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−3 removed

  • other:+9 added−3 removed

2 files+9 added−3 removed

modified:requests/exceptions.py+6 added
28 unmodified lines
29 """A valid URL is required to make a request."""3031class TooManyRedirects(RequestException):32 """Too many redirects."""3334class MissingSchema(RequestException, ValueError):35 """The URL schema (e.g. http or https) is missing."""3637class InvalidSchema(RequestException, ValueError):38 """See defaults.py for valid schemas."""
modified:requests/models.py+3 added-3 removed
22 unmodified lines
23from .packages.urllib3.filepost import encode_multipart_formdata24from .defaults import SCHEMAS25from .exceptions import (26 ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects,27 URLRequired, SSLError)27 URLRequired, SSLError, MissingSchema, InvalidSchema)28from .utils import (29 get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri,30 dict_from_string, stream_decode_response_unicode, get_netrc_auth)31from .compat import (
293 unmodified lines
325 # Support for unicode domain names and paths.326 scheme, netloc, path, params, query, fragment = urlparse(url)327328 if not scheme:329 raise ValueError("Invalid URL %r: No schema supplied" % url)329 raise MissingSchema("Invalid URL %r: No schema supplied" % url)330331 if not scheme in SCHEMAS:332 raise ValueError("Invalid scheme %r" % scheme)332 raise InvalidSchema("Invalid scheme %r" % scheme)333334 netloc = netloc.encode('idna').decode('utf-8')335336 if not path:
466 unmodified lines