requests API Reference
Full documentation for requests (2.34.2)
requests.ConnectTimeout
Python Library Documentation: class ConnectTimeout in module requests.exceptions
class ConnectTimeout(ConnectionError, Timeout)
| ConnectTimeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The request timed out while trying to connect to the remote server.
|
| Requests that produced this error are safe to retry.
|
| Method resolution order:
| ConnectTimeout
| ConnectionError
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.ConnectionError
Python Library Documentation: class ConnectionError in module requests.exceptions
class ConnectionError(RequestException)
| ConnectionError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A Connection error occurred.
|
| Method resolution order:
| ConnectionError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.DependencyWarning
Python Library Documentation: class DependencyWarning in module urllib3.exceptions class DependencyWarning(HTTPWarning) | Warned when an attempt is made to import a module with missing optional | dependencies. | | Method resolution order: | DependencyWarning | HTTPWarning | builtins.Warning | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from HTTPWarning: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Warning: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Warning: | | __new__(*args, **kwargs) class method of builtins.Warning | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
requests.FileModeWarning
Python Library Documentation: class FileModeWarning in module requests.exceptions class FileModeWarning(RequestsWarning, builtins.DeprecationWarning) | A file was opened in text mode, but Requests determined its binary length. | | Method resolution order: | FileModeWarning | RequestsWarning | builtins.DeprecationWarning | builtins.Warning | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from RequestsWarning: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.DeprecationWarning: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.DeprecationWarning: | | __new__(*args, **kwargs) class method of builtins.DeprecationWarning | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
requests.HTTPError
Python Library Documentation: class HTTPError in module requests.exceptions
class HTTPError(RequestException)
| HTTPError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| An HTTP error occurred.
|
| Method resolution order:
| HTTPError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.JSONDecodeError
Python Library Documentation: class JSONDecodeError in module requests.exceptions
class JSONDecodeError(InvalidJSONError, simplejson.errors.JSONDecodeError)
| JSONDecodeError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Couldn't decode the text into json
|
| Method resolution order:
| JSONDecodeError
| InvalidJSONError
| RequestException
| builtins.OSError
| simplejson.errors.JSONDecodeError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Construct the JSONDecodeError instance first with all
| args. Then use it's args to construct the IOError so that
| the json specific args aren't used as IOError specific args
| and the error message from JSONDecodeError is preserved.
|
| __reduce__(self) -> 'tuple[Any, ...] | str'
| The __reduce__ method called when pickling the object must
| be the one from the JSONDecodeError (be it json/simplejson)
| as it expects all the arguments for instantiation, not just
| one like the IOError, and the MRO would by default call the
| __reduce__ method from the IOError due to the inheritance order.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.NullHandler
Python Library Documentation: class NullHandler in module logging class NullHandler(Handler) | NullHandler(level=0) | | This handler does nothing. It's intended to be used to avoid the | "No handlers could be found for logger XXX" one-off warning. This is | important for library code, which may contain code to log events. If a user | of the library does not configure logging, the one-off warning might be | produced; to avoid this, the library developer simply needs to instantiate | a NullHandler and add it to the top-level logger of the library module or | package. | | Method resolution order: | NullHandler | Handler | Filterer | builtins.object | | Methods defined here: | | createLock(self) | Acquire a thread lock for serializing access to the underlying I/O. | | emit(self, record) | Stub. | | handle(self, record) | Stub. | | ---------------------------------------------------------------------- | Methods inherited from Handler: | | __init__(self, level=0) | Initializes the instance - basically setting the formatter to None | and the filter list to empty. | | __repr__(self) | Return repr(self). | | acquire(self) | Acquire the I/O thread lock. | | close(self) | Tidy up any resources used by the handler. | | This version removes the handler from an internal map of handlers, | _handlers, which is used for handler lookup by name. Subclasses | should ensure that this gets called from overridden close() | methods. | | flush(self) | Ensure all logging output has been flushed. | | This version does nothing and is intended to be implemented by | subclasses. | | format(self, record) | Format the specified record. | | If a formatter is set, use it. Otherwise, use the default formatter | for the module. | | get_name(self) | | handleError(self, record) | Handle errors which occur during an emit() call. | | This method should be called from handlers when an exception is | encountered during an emit() call. If raiseExceptions is false, | exceptions get silently ignored. This is what is mostly wanted | for a logging system - most users will not care about errors in | the logging system, they are more interested in application errors. | You could, however, replace this with a custom handler if you wish. | The record which was being processed is passed in to this method. | | release(self) | Release the I/O thread lock. | | setFormatter(self, fmt) | Set the formatter for this handler. | | setLevel(self, level) | Set the logging level of this handler. level must be an int or a str. | | set_name(self, name) | | ---------------------------------------------------------------------- | Data descriptors inherited from Handler: | | name | | ---------------------------------------------------------------------- | Methods inherited from Filterer: | | addFilter(self, filter) | Add the specified filter to this handler. | | filter(self, record) | Determine if a record is loggable by consulting all the filters. | | The default is to allow the record to be logged; any filter can veto | this by returning a false value. | If a filter attached to a handler returns a log record instance, | then that instance is used in place of the original log record in | any further processing of the event by that handler. | If a filter returns any other true value, the original log record | is used in any further processing of the event by that handler. | | If none of the filters return false values, this method returns | a log record. | If any of the filters return a false value, this method returns | a false value. | | .. versionchanged:: 3.2 | | Allow filters to be just callables. | | .. versionchanged:: 3.12 | Allow filters to return a LogRecord instead of | modifying it in place. | | removeFilter(self, filter) | Remove the specified filter from this handler. | | ---------------------------------------------------------------------- | Data descriptors inherited from Filterer: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
requests.PreparedRequest
Python Library Documentation: class PreparedRequest in module requests.models
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin)
| PreparedRequest() -> 'None'
|
| The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
| containing the exact bytes that will be sent to the server.
|
| Instances are generated from a :class:`Request <Request>` object, and
| should not be instantiated manually; doing so may produce undesirable
| effects.
|
| Usage::
|
| >>> import requests
| >>> req = requests.Request('GET', 'https://httpbin.org/get')
| >>> r = req.prepare()
| >>> r
| <PreparedRequest [GET]>
|
| >>> s = requests.Session()
| >>> s.send(r)
| <Response [200]>
|
| Method resolution order:
| PreparedRequest
| RequestEncodingMixin
| RequestHooksMixin
| builtins.object
|
| Methods defined here:
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| copy(self) -> 'PreparedRequest'
|
| prepare(self, method: 'str | None' = None, url: '_t.UriType | None' = None, headers: 'Mapping[str, str | bytes] | None' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
| Prepares the entire request with the given parameters.
|
| prepare_auth(self, auth: '_t.AuthType', url: '_t.UriType' = '') -> 'None'
| Prepares the given HTTP auth data.
|
| prepare_body(self, data: '_t.DataType', files: '_t.FilesType', json: '_t.JsonType' = None) -> 'None'
| Prepares the given HTTP body data.
|
| prepare_content_length(self, body: '_t.BodyType') -> 'None'
| Prepare Content-Length header based on request method and body
|
| prepare_cookies(self, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None') -> 'None'
| Prepares the given HTTP cookie data.
|
| This function eventually generates a ``Cookie`` header from the
| given cookies using cookielib. Due to cookielib's design, the header
| will not be regenerated if it already exists, meaning this function
| can only be called once for the life of the
| :class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
| to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
| header is removed beforehand.
|
| prepare_headers(self, headers: 'Mapping[str, str | bytes] | None') -> 'None'
| Prepares the given HTTP headers.
|
| prepare_hooks(self, hooks: '_t.HooksInputType | None') -> 'None'
| Prepares the given hooks.
|
| prepare_method(self, method: 'str | None') -> 'None'
| Prepares the given HTTP method.
|
| prepare_url(self, url: '_t.UriType', params: '_t.ParamsType') -> 'None'
| Prepares the given HTTP URL.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_body_position': 'int | object | None', '_cookies'...
|
| ----------------------------------------------------------------------
| Readonly properties inherited from RequestEncodingMixin:
|
| path_url
| Build the path URL to use.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestEncodingMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from RequestHooksMixin:
|
| deregister_hook(self, event: 'str', hook: '_t.HookType') -> 'bool'
| Deregister a previously registered hook.
| Returns True if the hook existed, False if not.
|
| register_hook(self, event: 'str', hook: 'Iterable[_t.HookType] | _t.HookType') -> 'None'
| Properly register a hook.
requests.ReadTimeout
Python Library Documentation: class ReadTimeout in module requests.exceptions
class ReadTimeout(Timeout)
| ReadTimeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The server did not send any data in the allotted amount of time.
|
| Method resolution order:
| ReadTimeout
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.Request
Python Library Documentation: class Request in module requests.models
class Request(RequestHooksMixin)
| Request(method: 'str | None' = None, url: '_t.UriType | None' = None, headers: '_t.HeadersType' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
|
| A user-created :class:`Request <Request>` object.
|
| Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
|
| :param method: HTTP method to use.
| :param url: URL to send.
| :param headers: dictionary of headers to send.
| :param files: dictionary of {filename: fileobject} files to multipart upload.
| :param data: the body to attach to the request. If a dictionary or
| list of tuples ``[(key, value)]`` is provided, form-encoding will
| take place.
| :param json: json for the body to attach to the request (if files or data is not specified).
| :param params: URL parameters to append to the URL. If a dictionary or
| list of tuples ``[(key, value)]`` is provided, form-encoding will
| take place.
| :param auth: Auth handler or (user, pass) tuple.
| :param cookies: dictionary or CookieJar of cookies to attach to this request.
| :param hooks: dictionary of callback hooks, for internal usage.
|
| Usage::
|
| >>> import requests
| >>> req = requests.Request('GET', 'https://httpbin.org/get')
| >>> req.prepare()
| <PreparedRequest [GET]>
|
| Method resolution order:
| Request
| RequestHooksMixin
| builtins.object
|
| Methods defined here:
|
| __init__(self, method: 'str | None' = None, url: '_t.UriType | None' = None, headers: '_t.HeadersType' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| prepare(self) -> 'PreparedRequest'
| Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'auth': '_t.AuthType', 'cookies': 'RequestsCookieJa...
|
| ----------------------------------------------------------------------
| Methods inherited from RequestHooksMixin:
|
| deregister_hook(self, event: 'str', hook: '_t.HookType') -> 'bool'
| Deregister a previously registered hook.
| Returns True if the hook existed, False if not.
|
| register_hook(self, event: 'str', hook: 'Iterable[_t.HookType] | _t.HookType') -> 'None'
| Properly register a hook.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestHooksMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
requests.RequestException
Python Library Documentation: class RequestException in module requests.exceptions
class RequestException(builtins.OSError)
| RequestException(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| There was an ambiguous exception that occurred while handling your
| request.
|
| Method resolution order:
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'request': 'Request | PreparedRequest | None', 'res...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.RequestsDependencyWarning
Python Library Documentation: class RequestsDependencyWarning in module requests.exceptions class RequestsDependencyWarning(RequestsWarning) | An imported dependency doesn't match the expected version range. | | Method resolution order: | RequestsDependencyWarning | RequestsWarning | builtins.Warning | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from RequestsWarning: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.Warning: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Warning: | | __new__(*args, **kwargs) class method of builtins.Warning | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | add_note(...) | Exception.add_note(note) -- | add a note to the exception | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args
requests.Response
Python Library Documentation: class Response in module requests.models
class Response(builtins.object)
| Response() -> 'None'
|
| The :class:`Response <Response>` object, which contains a
| server's response to an HTTP request.
|
| Methods defined here:
|
| __bool__(self) -> 'bool'
| Returns True if :attr:`status_code` is less than 400.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code, is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| __enter__(self) -> 'Self'
|
| __exit__(self, *args: 'Any') -> 'None'
|
| __getstate__(self) -> 'dict[str, Any]'
| Helper for pickle.
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[bytes]'
| Allows you to use a response as an iterator.
|
| __nonzero__(self) -> 'bool'
| Returns True if :attr:`status_code` is less than 400.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code, is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
|
| close(self) -> 'None'
| Releases the connection back to the pool. Once this method has been
| called the underlying ``raw`` object must not be accessed again.
|
| *Note: Should not normally need to be called explicitly.*
|
| iter_content(self, chunk_size: 'int | None' = 1, decode_unicode: 'bool' = False) -> 'Iterator[str | bytes]'
| Iterates over the response data. When stream=True is set on the
| request, this avoids reading the content at once into memory for
| large responses. The chunk size is the number of bytes it should
| read into memory. This is not necessarily the length of each item
| returned as decoding can take place.
|
| chunk_size must be of type int or None. A value of None will
| function differently depending on the value of `stream`.
| stream=True will read data as it arrives in whatever size the
| chunks are received. If stream=False, data is returned as
| a single chunk.
|
| If decode_unicode is True, content will be decoded using encoding
| information from the response. If no encoding information is available,
| bytes will be returned. This can be bypassed by manually setting
| `encoding` on the response.
|
| iter_lines(self, chunk_size: 'int' = 512, decode_unicode: 'bool' = False, delimiter: 'str | bytes | None' = None) -> 'Iterator[str | bytes]'
| Iterates over the response data, one line at a time. When
| stream=True is set on the request, this avoids reading the
| content at once into memory for large responses.
|
| The decode_unicode param works the same as in `iter_content`, with the
| same caveats.
|
| .. note:: This method is not reentrant safe.
|
| json(self, **kwargs: 'Any') -> 'Any'
| Decodes the JSON response body (if any) as a Python object.
|
| This may return a dictionary, list, etc. depending on what is in the response.
|
| :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
| :raises requests.exceptions.JSONDecodeError: If the response body does not
| contain valid json.
|
| raise_for_status(self) -> 'None'
| Raises :class:`HTTPError`, if one occurred.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| apparent_encoding
| The apparent encoding, provided by the charset_normalizer or chardet libraries.
|
| content
| Content of the response, in bytes.
|
| is_permanent_redirect
| True if this Response one of the permanent versions of redirect.
|
| is_redirect
| True if this Response is a well-formed HTTP redirect that could have
| been processed automatically (by :meth:`Session.resolve_redirects`).
|
| links
| Returns the parsed header links of the response, if any.
|
| next
| Returns a PreparedRequest for the next request in a redirect chain, if there is one.
|
| ok
| Returns True if :attr:`status_code` is less than 400, False if not.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| text
| Content of the response, in unicode.
|
| If Response.encoding is None, encoding will be guessed using
| ``charset_normalizer`` or ``chardet``.
|
| The encoding of the response content is determined based solely on HTTP
| headers, following RFC 2616 to the letter. If you can take advantage of
| non-HTTP knowledge to make a better guess at the encoding, you should
| set ``r.encoding`` appropriately before accessing this property.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'__attrs__': 'list[str]', '_content': 'bytes | Lite...
|
| __attrs__ = ['_content', 'status_code', 'headers', 'url', 'history', '...
requests.Session
Python Library Documentation: class Session in module requests.sessions
class Session(SessionRedirectMixin)
| Session() -> 'None'
|
| A Requests session.
|
| Provides cookie persistence, connection-pooling, and configuration.
|
| Basic Usage::
|
| >>> import requests
| >>> s = requests.Session()
| >>> s.get('https://httpbin.org/get')
| <Response [200]>
|
| Or as a context manager::
|
| >>> with requests.Session() as s:
| ... s.get('https://httpbin.org/get')
| <Response [200]>
|
| Method resolution order:
| Session
| SessionRedirectMixin
| builtins.object
|
| Methods defined here:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, *args: 'Any') -> 'None'
|
| __getstate__(self) -> 'dict[str, Any]'
| Helper for pickle.
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
|
| close(self) -> 'None'
| Closes all adapters and as such the session
|
| delete(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a DELETE request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| get(self, url: '_t.UriType', params: '_t.ParamsType' = None, **kwargs: 'Unpack[_t.GetKwargs]') -> 'Response'
| Sends a GET request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param params: (optional) Dictionary, list of tuples or bytes to send
| in the query string for the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| get_adapter(self, url: 'str') -> 'BaseAdapter'
| Returns the appropriate connection adapter for the given URL.
|
| :rtype: requests.adapters.BaseAdapter
|
| head(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a HEAD request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| merge_environment_settings(self, url: 'str', proxies: 'dict[str, str] | None', stream: 'bool | None', verify: '_t.VerifyType | None', cert: '_t.CertType') -> 'dict[str, Any]'
| Check the environment and merge it with some settings.
|
| :rtype: dict
|
| mount(self, prefix: 'str', adapter: 'BaseAdapter') -> 'None'
| Registers a connection adapter to a prefix.
|
| Adapters are sorted in descending order by prefix length.
|
| options(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a OPTIONS request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| patch(self, url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
| Sends a PATCH request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| post(self, url: '_t.UriType', data: '_t.DataType' = None, json: '_t.JsonType' = None, **kwargs: 'Unpack[_t.PostKwargs]') -> 'Response'
| Sends a POST request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param json: (optional) json to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| prepare_request(self, request: 'Request') -> 'PreparedRequest'
| Constructs a :class:`PreparedRequest <PreparedRequest>` for
| transmission and returns it. The :class:`PreparedRequest` has settings
| merged from the :class:`Request <Request>` instance and those of the
| :class:`Session`.
|
| :param request: :class:`Request` instance to prepare with this
| session's settings.
| :rtype: requests.PreparedRequest
|
| put(self, url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
| Sends a PUT request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| request(self, method: 'str', url: '_t.UriType', params: '_t.ParamsType' = None, data: '_t.DataType' = None, headers: '_t.HeadersType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, files: '_t.FilesType' = None, auth: '_t.AuthType' = None, timeout: '_t.TimeoutType' = None, allow_redirects: 'bool' = True, proxies: 'dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, stream: 'bool | None' = None, verify: '_t.VerifyType | None' = None, cert: '_t.CertType' = None, json: '_t.JsonType' = None) -> 'Response'
| Constructs a :class:`Request <Request>`, prepares it and sends it.
| Returns :class:`Response <Response>` object.
|
| :param method: method for the new :class:`Request` object.
| :param url: URL for the new :class:`Request` object.
| :param params: (optional) Dictionary or bytes to be sent in the query
| string for the :class:`Request`.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param json: (optional) json to send in the body of the
| :class:`Request`.
| :param headers: (optional) Dictionary of HTTP Headers to send with the
| :class:`Request`.
| :param cookies: (optional) Dict or CookieJar object to send with the
| :class:`Request`.
| :param files: (optional) Dictionary of ``'filename': file-like-objects``
| for multipart encoding upload.
| :param auth: (optional) Auth tuple or callable to enable
| Basic/Digest/Custom HTTP Auth.
| :param timeout: (optional) How many seconds to wait for the server to send
| data before giving up, as a float, or a :ref:`(connect timeout,
| read timeout) <timeouts>` tuple.
| :type timeout: float or tuple
| :param allow_redirects: (optional) Set to True by default.
| :type allow_redirects: bool
| :param proxies: (optional) Dictionary mapping protocol or protocol and
| hostname to the URL of the proxy.
| :param hooks: (optional) Dictionary mapping hook name to one event or
| list of events, event must be callable.
| :param stream: (optional) whether to immediately download the response
| content. Defaults to ``False``.
| :param verify: (optional) Either a boolean, in which case it controls whether we verify
| the server's TLS certificate, or a string, in which case it must be a path
| to a CA bundle to use. Defaults to ``True``. When set to
| ``False``, requests will accept any TLS certificate presented by
| the server, and will ignore hostname mismatches and/or expired
| certificates, which will make your application vulnerable to
| man-in-the-middle (MitM) attacks. Setting verify to ``False``
| may be useful during local development or testing.
| :param cert: (optional) if String, path to ssl client cert file (.pem).
| If Tuple, ('cert', 'key') pair.
| :rtype: requests.Response
|
| send(self, request: 'PreparedRequest', **kwargs: 'Any') -> 'Response'
| Send a given PreparedRequest.
|
| :rtype: requests.Response
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'__attrs__': 'list[str]', 'adapters': 'MutableMappi...
|
| __attrs__ = ['headers', 'cookies', 'auth', 'proxies', 'hooks', 'params...
|
| ----------------------------------------------------------------------
| Methods inherited from SessionRedirectMixin:
|
| get_redirect_target(self, resp: 'Response') -> 'str | None'
| Receives a Response. Returns a redirect URI or ``None``
|
| rebuild_auth(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to strip authentication from the
| request to avoid leaking credentials. This method intelligently removes
| and reapplies authentication where possible to avoid credential loss.
|
| rebuild_method(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to change the method of the request
| based on certain specs or browser behavior.
|
| rebuild_proxies(self, prepared_request: 'PreparedRequest', proxies: 'dict[str, str] | None') -> 'dict[str, str]'
| This method re-evaluates the proxy configuration by considering the
| environment variables. If we are redirected to a URL covered by
| NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
| proxy keys for this URL (in case they were stripped by a previous
| redirect).
|
| This method also replaces the Proxy-Authorization header where
| necessary.
|
| :rtype: dict
|
| resolve_redirects(self, resp: 'Response', req: 'PreparedRequest', stream: 'bool' = False, timeout: '_t.TimeoutType' = None, verify: '_t.VerifyType' = True, cert: '_t.CertType' = None, proxies: 'dict[str, str] | None' = None, yield_requests: 'bool' = False, **adapter_kwargs: 'Any') -> 'Generator[Response, None, None]'
| Receives a Response. Returns a generator of Responses or Requests.
|
| should_strip_auth(self, old_url: 'str', new_url: 'str') -> 'bool'
| Decide whether Authorization header should be removed when redirecting
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SessionRedirectMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
requests.Timeout
Python Library Documentation: class Timeout in module requests.exceptions
class Timeout(RequestException)
| Timeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The request timed out.
|
| Catching this error will catch both
| :exc:`~requests.exceptions.ConnectTimeout` and
| :exc:`~requests.exceptions.ReadTimeout` errors.
|
| Method resolution order:
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.TooManyRedirects
Python Library Documentation: class TooManyRedirects in module requests.exceptions
class TooManyRedirects(RequestException)
| TooManyRedirects(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Too many redirects.
|
| Method resolution order:
| TooManyRedirects
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.URLRequired
Python Library Documentation: class URLRequired in module requests.exceptions
class URLRequired(RequestException)
| URLRequired(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A valid URL is required to make a request.
|
| Method resolution order:
| URLRequired
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
requests.adapters
Python Library Documentation: module requests.adapters in requests
NAME
requests.adapters
DESCRIPTION
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
CLASSES
builtins.object
BaseAdapter
HTTPAdapter
class BaseAdapter(builtins.object)
| BaseAdapter() -> 'None'
|
| The Base Transport Adapter
|
| Methods defined here:
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| close(self) -> 'None'
| Cleans up adapter specific items.
|
| send(self, request: 'PreparedRequest', stream: 'bool' = False, timeout: '_t.TimeoutType' = None, verify: '_t.VerifyType' = True, cert: '_t.CertType' = None, proxies: 'dict[str, str] | None' = None) -> 'Response'
| Sends PreparedRequest object. Returns Response object.
|
| :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
| :param stream: (optional) Whether to stream the request content.
| :param timeout: (optional) How long to wait for the server to send
| data before giving up, as a float, or a :ref:`(connect timeout,
| read timeout) <timeouts>` tuple.
| :type timeout: float or tuple
| :param verify: (optional) Either a boolean, in which case it controls whether we verify
| the server's TLS certificate, or a string, in which case it must be a path
| to a CA bundle to use
| :param cert: (optional) Any user-provided SSL certificate to be trusted.
| :param proxies: (optional) The proxies dictionary to apply to the request.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPAdapter(BaseAdapter)
| HTTPAdapter(pool_connections: 'int' = 10, pool_maxsize: 'int' = 10, max_retries: 'int | Retry' = 0, pool_block: 'bool' = False) -> 'None'
|
| The built-in HTTP Adapter for urllib3.
|
| Provides a general-case interface for Requests sessions to contact HTTP and
| HTTPS urls by implementing the Transport Adapter interface. This class will
| usually be created by the :class:`Session <Session>` class under the
| covers.
|
| :param pool_connections: The number of urllib3 connection pools to cache.
| :param pool_maxsize: The maximum number of connections to save in the pool.
| :param max_retries: The maximum number of retries each connection
| should attempt. Note, this applies only to failed DNS lookups, socket
| connections and connection timeouts, never to requests where data has
| made it to the server. By default, Requests does not retry failed
| connections. If you need granular control over the conditions under
| which we retry a request, import urllib3's ``Retry`` class and pass
| that instead.
| :param pool_block: Whether the connection pool should block for connections.
|
| Usage::
|
| >>> import requests
| >>> s = requests.Session()
| >>> a = requests.adapters.HTTPAdapter(max_retries=3)
| >>> s.mount('http://', a)
|
| Method resolution order:
| HTTPAdapter
| BaseAdapter
| builtins.object
|
| Methods defined here:
|
| __getstate__(self) -> 'dict[str, Any]'
| Helper for pickle.
|
| __init__(self, pool_connections: 'int' = 10, pool_maxsize: 'int' = 10, max_retries: 'int | Retry' = 0, pool_block: 'bool' = False) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
|
| add_headers(self, request: 'PreparedRequest', **kwargs: 'Any') -> 'None'
| Add any headers needed by the connection. As of v2.0 this does
| nothing by default, but is left for overriding by users that subclass
| the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| This should not be called from user code, and is only exposed for use
| when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
| :param kwargs: The keyword arguments from the call to send().
|
| build_connection_pool_key_attributes(self, request: 'PreparedRequest', verify: '_t.VerifyType', cert: '_t.CertType' = None) -> 'tuple[dict[str, Any], dict[str, Any]]'
| Build the PoolKey attributes used by urllib3 to return a connection.
|
| This looks at the PreparedRequest, the user-specified verify value,
| and the value of the cert parameter to determine what PoolKey values
| to use to select a connection from a given urllib3 Connection Pool.
|
| The SSL related pool key arguments are not consistently set. As of
| this writing, use the following to determine what keys may be in that
| dictionary:
|
| * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the
| default Requests SSL Context
| * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but
| ``"cert_reqs"`` will be set
| * If ``verify`` is a string, (i.e., it is a user-specified trust bundle)
| ``"ca_certs"`` will be set if the string is not a directory recognized
| by :py:func:`os.path.isdir`, otherwise ``"ca_cert_dir"`` will be
| set.
| * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If
| ``"cert"`` is a tuple with a second item, ``"key_file"`` will also
| be present
|
| To override these settings, one may subclass this class, call this
| method and use the above logic to change parameters as desired. For
| example, if one wishes to use a custom :py:class:`ssl.SSLContext` one
| must both set ``"ssl_context"`` and based on what else they require,
| alter the other keys to ensure the desired behaviour.
|
| :param request:
| The PreparedRequest being sent over the connection.
| :type request:
| :class:`~requests.models.PreparedRequest`
| :param verify:
| Either a boolean, in which case it controls whether
| we verify the server's TLS certificate, or a string, in which case it
| must be a path to a CA bundle to use.
| :param cert:
| (optional) Any user-provided SSL certificate for client
| authentication (a.k.a., mTLS). This may be a string (i.e., just
| the path to a file which holds both certificate and key) or a
| tuple of length 2 with the certificate file path and key file
| path.
| :returns:
| A tuple of two dictionaries. The first is the "host parameters"
| portion of the Pool Key including scheme, hostname, and port. The
| second is a dictionary of SSLContext related parameters.
|
| build_response(self, req: 'PreparedRequest', resp: 'Any') -> 'Response'
| Builds a :class:`Response <requests.Response>` object from a urllib3
| response. This should not be called from user code, and is only exposed
| for use when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
|
| :param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
| :param resp: The urllib3 response object.
| :rtype: requests.Response
|
| cert_verify(self, conn: 'Any', url: 'str', verify: '_t.VerifyType', cert: '_t.CertType') -> 'None'
| Verify a SSL certificate. This method should not be called from user
| code, and is only exposed for use when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param conn: The urllib3 connection object associated with the cert.
| :param url: The requested URL.
| :param verify: Either a boolean, in which case it controls whether we verify
| the server's TLS certificate, or a string, in which case it must be a path
| to a CA bundle to use
| :param cert: The SSL certificate to verify.
|
| close(self) -> 'None'
| Disposes of any internal state.
|
| Currently, this closes the PoolManager and any active ProxyManager,
| which closes any pooled connections.
|
| get_connection(self, url: 'str', proxies: 'dict[str, str] | None' = None) -> 'HTTPConnectionPool'
| DEPRECATED: Users should move to `get_connection_with_tls_context`
| for all subclasses of HTTPAdapter using Requests>=2.32.2.
|
| Returns a urllib3 connection for the given URL. This should not be
| called from user code, and is only exposed for use when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param url: The URL to connect to.
| :param proxies: (optional) A Requests-style dictionary of proxies used on this request.
| :rtype: urllib3.HTTPConnectionPool
|
| get_connection_with_tls_context(self, request: 'PreparedRequest', verify: '_t.VerifyType', proxies: 'dict[str, str] | None' = None, cert: '_t.CertType' = None) -> 'HTTPConnectionPool'
| Returns a urllib3 connection for the given request and TLS settings.
| This should not be called from user code, and is only exposed for use
| when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param request:
| The :class:`PreparedRequest <PreparedRequest>` object to be sent
| over the connection.
| :param verify:
| Either a boolean, in which case it controls whether we verify the
| server's TLS certificate, or a string, in which case it must be a
| path to a CA bundle to use.
| :param proxies:
| (optional) The proxies dictionary to apply to the request.
| :param cert:
| (optional) Any user-provided SSL certificate to be used for client
| authentication (a.k.a., mTLS).
| :rtype:
| urllib3.HTTPConnectionPool
|
| init_poolmanager(self, connections: 'int', maxsize: 'int', block: 'bool' = False, **pool_kwargs: 'Any') -> 'None'
| Initializes a urllib3 PoolManager.
|
| This method should not be called from user code, and is only
| exposed for use when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param connections: The number of urllib3 connection pools to cache.
| :param maxsize: The maximum number of connections to save in the pool.
| :param block: Block when no free connections are available.
| :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
|
| proxy_headers(self, proxy: 'str') -> 'dict[str, str]'
| Returns a dictionary of the headers to add to any request sent
| through a proxy. This works with urllib3 magic to ensure that they are
| correctly sent to the proxy, rather than in a tunnelled request if
| CONNECT is being used.
|
| This should not be called from user code, and is only exposed for use
| when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param proxy: The url of the proxy being used for this request.
| :rtype: dict
|
| proxy_manager_for(self, proxy: 'str', **proxy_kwargs: 'Any') -> 'Any'
| Return urllib3 ProxyManager for the given proxy.
|
| This method should not be called from user code, and is only
| exposed for use when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param proxy: The proxy to return a urllib3 ProxyManager for.
| :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
| :returns: ProxyManager
| :rtype: urllib3.ProxyManager
|
| request_url(self, request: 'PreparedRequest', proxies: 'dict[str, str] | None') -> 'str'
| Obtain the url to use when making the final request.
|
| If the message is being sent through a HTTP proxy, the full URL has to
| be used. Otherwise, we should only use the path portion of the URL.
|
| This should not be called from user code, and is only exposed for use
| when subclassing the
| :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
| :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
| :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
| :rtype: str
|
| send(self, request: 'PreparedRequest', stream: 'bool' = False, timeout: '_t.TimeoutType' = None, verify: '_t.VerifyType' = True, cert: '_t.CertType' = None, proxies: 'dict[str, str] | None' = None) -> 'Response'
| Sends PreparedRequest object. Returns Response object.
|
| :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
| :param stream: (optional) Whether to stream the request content.
| :param timeout: (optional) How long to wait for the server to send
| data before giving up, as a float, or a :ref:`(connect timeout,
| read timeout) <timeouts>` tuple.
| :type timeout: float or tuple or urllib3 Timeout object
| :param verify: (optional) Either a boolean, in which case it controls whether
| we verify the server's TLS certificate, or a string, in which case it
| must be a path to a CA bundle to use
| :param cert: (optional) Any user-provided SSL certificate to be trusted.
| :param proxies: (optional) The proxies dictionary to apply to the request.
| :rtype: requests.Response
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'__attrs__': 'list[str]', '_pool_block': 'bool', '_...
|
| __attrs__ = ['max_retries', 'config', '_pool_connections', '_pool_maxs...
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseAdapter:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
DEFAULT_CA_BUNDLE_PATH = r'C:\Users\Youse\AppData\Local\Programs\Pytho...
DEFAULT_POOLBLOCK = False
DEFAULT_POOLSIZE = 10
DEFAULT_POOL_TIMEOUT = None
DEFAULT_RETRIES = 0
basestring = (<class 'str'>, <class 'bytes'>)
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\adapters.py
requests.annotations
Python Library Documentation: _Feature in module __future__ object class _Feature(builtins.object) | _Feature(optionalRelease, mandatoryRelease, compiler_flag) | | Methods defined here: | | __init__(self, optionalRelease, mandatoryRelease, compiler_flag) | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | getMandatoryRelease(self) | Return release in which this feature will become mandatory. | | This is a 5-tuple, of the same form as sys.version_info, or, if | the feature was dropped, or the release date is undetermined, is None. | | getOptionalRelease(self) | Return first release in which this feature was recognized. | | This is a 5-tuple, of the same form as sys.version_info. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
requests.api
Python Library Documentation: module requests.api in requests
NAME
requests.api
DESCRIPTION
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
FUNCTIONS
delete(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
get(url: '_t.UriType', params: '_t.ParamsType' = None, **kwargs: 'Unpack[_t.GetKwargs]') -> 'Response'
Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
head(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. If
`allow_redirects` is not provided, it will be set to `False` (as
opposed to the default :meth:`request` behavior).
:return: :class:`Response <Response>` object
:rtype: requests.Response
options(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends an OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
patch(url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
post(url: '_t.UriType', data: '_t.DataType' = None, json: '_t.JsonType' = None, **kwargs: 'Unpack[_t.PostKwargs]') -> 'Response'
Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
put(url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
request(method: 'str', url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content_type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
to add for the file.
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How many seconds to wait for the server to send data
before giving up, as a float, or a :ref:`(connect timeout, read
timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
:return: :class:`Response <Response>` object
:rtype: requests.Response
Usage::
>>> import requests
>>> req = requests.request('GET', 'https://httpbin.org/get')
>>> req
<Response [200]>
DATA
TYPE_CHECKING = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\api.py
requests.auth
Python Library Documentation: module requests.auth in requests
NAME
requests.auth
DESCRIPTION
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
CLASSES
builtins.object
AuthBase
HTTPBasicAuth
HTTPProxyAuth
HTTPDigestAuth
class AuthBase(builtins.object)
| Base class that all auth implementations derive from
|
| Methods defined here:
|
| __call__(self, r: 'PreparedRequest') -> 'PreparedRequest'
| Call self as a function.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPBasicAuth(AuthBase)
| HTTPBasicAuth(username: 'bytes | str', password: 'bytes | str') -> 'None'
|
| Attaches HTTP Basic Authentication to the given Request object.
|
| Method resolution order:
| HTTPBasicAuth
| AuthBase
| builtins.object
|
| Methods defined here:
|
| __call__(self, r: 'PreparedRequest') -> 'PreparedRequest'
| Call self as a function.
|
| __eq__(self, other: 'object') -> 'bool'
| Return self==value.
|
| __init__(self, username: 'bytes | str', password: 'bytes | str') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __ne__(self, other: 'Any') -> 'bool'
| Return self!=value.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'password': 'bytes | str', 'username': 'bytes | str...
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AuthBase:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPDigestAuth(AuthBase)
| HTTPDigestAuth(username: 'bytes | str', password: 'bytes | str') -> 'None'
|
| Attaches HTTP Digest Authentication to the given Request object.
|
| Method resolution order:
| HTTPDigestAuth
| AuthBase
| builtins.object
|
| Methods defined here:
|
| __call__(self, r: 'PreparedRequest') -> 'PreparedRequest'
| Call self as a function.
|
| __eq__(self, other: 'object') -> 'bool'
| Return self==value.
|
| __init__(self, username: 'bytes | str', password: 'bytes | str') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __ne__(self, other: 'Any') -> 'bool'
| Return self!=value.
|
| build_digest_header(self, method: 'str', url: 'str') -> 'str | None'
| :rtype: str
|
| handle_401(self, r: 'Response', **kwargs: 'Any') -> 'Response'
| Takes the given response and tries digest-auth, if needed.
|
| :rtype: requests.Response
|
| handle_redirect(self, r: 'Response', **kwargs: 'Any') -> 'None'
| Reset num_401_calls counter on redirects.
|
| init_per_thread_state(self) -> 'None'
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_thread_local': 'threading.local', 'chal': 'dict[s...
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AuthBase:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPProxyAuth(HTTPBasicAuth)
| HTTPProxyAuth(username: 'bytes | str', password: 'bytes | str') -> 'None'
|
| Attaches HTTP Proxy Authentication to a given Request object.
|
| Method resolution order:
| HTTPProxyAuth
| HTTPBasicAuth
| AuthBase
| builtins.object
|
| Methods defined here:
|
| __call__(self, r: 'PreparedRequest') -> 'PreparedRequest'
| Call self as a function.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPBasicAuth:
|
| __eq__(self, other: 'object') -> 'bool'
| Return self==value.
|
| __init__(self, username: 'bytes | str', password: 'bytes | str') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __ne__(self, other: 'Any') -> 'bool'
| Return self!=value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from HTTPBasicAuth:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AuthBase:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
CONTENT_TYPE_MULTI_PART = 'multipart/form-data'
Final = typing.Final
Special typing construct to indicate final names to type checkers.
A final name cannot be re-assigned or overridden in a subclass.
For example::
MAX_SIZE: Final = 9000
MAX_SIZE += 1 # Error reported by type checker
class Connection:
TIMEOUT: Final[int] = 10
class FastConnector(Connection):
TIMEOUT = 1 # Error reported by type checker
There is no runtime checking of these properties.
TYPE_CHECKING = False
__annotations__ = {'CONTENT_TYPE_FORM_URLENCODED': 'Final', 'CONTENT_T...
basestring = (<class 'str'>, <class 'bytes'>)
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\auth.py
requests.certs
Python Library Documentation: module requests.certs in requests
NAME
requests.certs
DESCRIPTION
requests.certs
~~~~~~~~~~~~~~
This module returns the preferred default CA certificate bundle. There is
only one — the one from the certifi package.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\certs.py
requests.chardet_version
Python Library Documentation: NoneType object class NoneType(object) | Methods defined here: | | __bool__(self, /) | True if self else False | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __le__(self, value, /) | Return self<=value. | | __lt__(self, value, /) | Return self<value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature.
requests.charset_normalizer_version
Error rendering doc: No Python documentation found for '3.3.2'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
requests.check_compatibility
Python Library Documentation: function check_compatibility in module requests check_compatibility(urllib3_version: 'str', chardet_version: 'str | None', charset_normalizer_version: 'str | None') -> 'None'
requests.codes
Python Library Documentation: LookupDict in module requests.structures object
class LookupDict(builtins.dict)
| LookupDict(name: 'Any' = None) -> 'None'
|
| Dictionary lookup object.
|
| Method resolution order:
| LookupDict
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __getattr__(self, key: 'str') -> '_VT | None'
|
| __getitem__(self, key: 'str') -> '_VT | None'
| Return self[key].
|
| __init__(self, name: 'Any' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| get(self, key: 'str', default: '_D | None' = None) -> '_VT | _D | None'
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'name': 'Any'}
|
| __orig_bases__ = (dict[str, ~_VT],)
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
requests.compat
Python Library Documentation: module requests.compat in requests
NAME
requests.compat
DESCRIPTION
requests.compat
~~~~~~~~~~~~~~~
This module previously handled import compatibility issues
between Python 2 and Python 3. It remains for backwards
compatibility until the next major version.
DATA
basestring = (<class 'str'>, <class 'bytes'>)
has_simplejson = True
integer_types = (<class 'int'>,)
is_py2 = False
is_py3 = True
is_urllib3_1 = False
numeric_types = (<class 'int'>, <class 'float'>)
urllib3_version = '2.7.0'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\compat.py
requests.cookies
Python Library Documentation: module requests.cookies in requests
NAME
requests.cookies
DESCRIPTION
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `http.cookiejar.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
CLASSES
builtins.RuntimeError(builtins.Exception)
CookieConflictError
builtins.object
MockRequest
MockResponse
collections.abc.MutableMapping(collections.abc.Mapping)
RequestsCookieJar(http.cookiejar.CookieJar, collections.abc.MutableMapping)
http.cookiejar.CookieJar(builtins.object)
RequestsCookieJar(http.cookiejar.CookieJar, collections.abc.MutableMapping)
class CookieConflictError(builtins.RuntimeError)
| There are two cookies that meet the criteria specified in the cookie jar.
| Use .get and .set and include domain and path args in order to be more specific.
|
| Method resolution order:
| CookieConflictError
| builtins.RuntimeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.RuntimeError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.RuntimeError:
|
| __new__(*args, **kwargs) class method of builtins.RuntimeError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class MockRequest(builtins.object)
| MockRequest(request: 'PreparedRequest') -> 'None'
|
| Wraps a `requests.PreparedRequest` to mimic a `urllib2.Request`.
|
| The code in `http.cookiejar.CookieJar` expects this interface in order to correctly
| manage cookie policies, i.e., determine whether a cookie can be set, given the
| domains of the request and the cookie.
|
| The original request object is read-only. The client is responsible for collecting
| the new headers via `get_new_headers()` and interpreting them appropriately. You
| probably want `get_cookie_header`, defined below.
|
| Methods defined here:
|
| __init__(self, request: 'PreparedRequest') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| add_header(self, key: 'str', val: 'str') -> 'None'
| cookiejar has no legitimate use for this method; add it back if you find one.
|
| add_unredirected_header(self, name: 'str', value: 'str') -> 'None'
|
| get_full_url(self) -> 'str'
|
| get_header(self, name: 'str', default: 'str | None' = None) -> 'str | None'
|
| get_host(self) -> 'str'
|
| get_new_headers(self) -> 'dict[str, str]'
|
| get_origin_req_host(self) -> 'str'
|
| get_type(self) -> 'str'
|
| has_header(self, name: 'str') -> 'bool'
|
| is_unverifiable(self) -> 'bool'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| host
|
| origin_req_host
|
| unverifiable
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'type': 'str'}
class MockResponse(builtins.object)
| MockResponse(headers: 'Any') -> 'None'
|
| Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
|
| ...what? Basically, expose the parsed HTTP headers from the server response
| the way `http.cookiejar` expects to see them.
|
| Methods defined here:
|
| __init__(self, headers: 'Any') -> 'None'
| Make a MockResponse for `cookiejar` to read.
|
| :param headers: a httplib.HTTPMessage or analogous carrying the headers
|
| getheaders(self, name: 'str') -> 'Any'
|
| info(self) -> 'Any'
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RequestsCookieJar(http.cookiejar.CookieJar, collections.abc.MutableMapping)
| RequestsCookieJar(policy=None)
|
| Compatibility class; is a http.cookiejar.CookieJar, but exposes a dict
| interface.
|
| This is the CookieJar we create by default for requests and sessions that
| don't specify one, since some clients may expect response.cookies and
| session.cookies to support dict operations.
|
| Requests does not use the dict interface internally; it's just for
| compatibility with external client code. All requests code should work
| out of the box with externally provided instances of ``CookieJar``, e.g.
| ``LWPCookieJar`` and ``FileCookieJar``.
|
| Unlike a regular CookieJar, this class is pickleable.
|
| .. warning:: dictionary operations that are normally O(1) may be O(n).
|
| Method resolution order:
| RequestsCookieJar
| http.cookiejar.CookieJar
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __contains__(self, name: 'object') -> 'bool'
|
| __delitem__(self, name: 'str') -> 'None'
| Deletes a cookie given a name. Wraps ``http.cookiejar.CookieJar``'s
| ``remove_cookie_by_name()``.
|
| __getitem__(self, name: 'str') -> 'str | None'
| Dict-like __getitem__() for compatibility with client code. Throws
| exception if there are more than one cookie with name. In that case,
| use the more explicit get() method instead.
|
| .. warning:: operation is O(n), not O(1).
|
| __getstate__(self) -> 'dict[str, Any]'
| Unlike a normal CookieJar, this class is pickleable.
|
| __iter__(self) -> 'Iterator[Cookie]'
| RequestCookieJar's __iter__ comes from CookieJar not MutableMapping.
|
| __setitem__(self, name: 'str', value: 'str | Morsel[dict[str, str]] | None') -> 'None'
| Dict-like __setitem__ for compatibility with client code. Throws
| exception if there is already a cookie of that name in the jar. In that
| case, use the more explicit set() method instead.
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
| Unlike a normal CookieJar, this class is pickleable.
|
| copy(self) -> 'RequestsCookieJar'
| Return a copy of this RequestsCookieJar.
|
| get(self, name: 'str', default: 'str | None' = None, domain: 'str | None' = None, path: 'str | None' = None) -> 'str | None'
| Dict-like get() that also supports optional domain and path args in
| order to resolve naming collisions from using one cookie jar over
| multiple domains.
|
| .. warning:: operation is O(n), not O(1).
|
| get_dict(self, domain: 'str | None' = None, path: 'str | None' = None) -> 'dict[str, str | None]'
| Takes as an argument an optional domain and path and returns a plain
| old Python dict of name-value pairs of cookies that meet the
| requirements.
|
| :rtype: dict
|
| get_policy(self) -> 'CookiePolicy'
| Return the CookiePolicy instance used.
|
| items(self) -> 'list[tuple[str, str | None]]'
| Dict-like items() that returns a list of name-value tuples from the
| jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
| vanilla python dict of key value pairs.
|
| .. seealso:: keys() and values().
|
| iteritems(self) -> 'Iterator[tuple[str, str | None]]'
| Dict-like iteritems() that returns an iterator of name-value tuples
| from the jar.
|
| .. seealso:: iterkeys() and itervalues().
|
| iterkeys(self) -> 'Iterator[str]'
| Dict-like iterkeys() that returns an iterator of names of cookies
| from the jar.
|
| .. seealso:: itervalues() and iteritems().
|
| itervalues(self) -> 'Iterator[str | None]'
| Dict-like itervalues() that returns an iterator of values of cookies
| from the jar.
|
| .. seealso:: iterkeys() and iteritems().
|
| keys(self) -> 'list[str]'
| Dict-like keys() that returns a list of names of cookies from the
| jar.
|
| .. seealso:: values() and items().
|
| list_domains(self) -> 'list[str]'
| Utility method to list all the domains in the jar.
|
| list_paths(self) -> 'list[str]'
| Utility method to list all the paths in the jar.
|
| multiple_domains(self) -> 'bool'
| Returns True if there are multiple domains in the jar.
| Returns False otherwise.
|
| :rtype: bool
|
| set(self, name: 'str', value: 'str | Morsel[dict[str, str]] | None', **kwargs: 'Any') -> 'Cookie | None'
| Dict-like set() that also supports optional domain and path args in
| order to resolve naming collisions from using one cookie jar over
| multiple domains.
|
| set_cookie(self, cookie: 'Cookie', *args: 'Any', **kwargs: 'Any') -> 'None'
| Set a cookie, without checking whether or not it should be set.
|
| update(self, other: 'CookieJar | SupportsKeysAndGetItem[str, str]') -> 'None'
| Updates this jar with cookies from another CookieJar or dict-like
|
| values(self) -> 'list[str | None]'
| Dict-like values() that returns a list of values of cookies from the
| jar.
|
| .. seealso:: keys() and items().
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'_policy': 'CookiePolicy'}
|
| __orig_bases__ = (<class 'http.cookiejar.CookieJar'>, collections.abc....
|
| ----------------------------------------------------------------------
| Methods inherited from http.cookiejar.CookieJar:
|
| __init__(self, policy=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __len__(self)
| Return number of contained cookies.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self)
| Return str(self).
|
| add_cookie_header(self, request)
| Add correct Cookie: header to request (urllib.request.Request object).
|
| The Cookie2 header is also added unless policy.hide_cookie2 is true.
|
| clear(self, domain=None, path=None, name=None)
| Clear some cookies.
|
| Invoking this method without arguments will clear all cookies. If
| given a single argument, only cookies belonging to that domain will be
| removed. If given two arguments, cookies belonging to the specified
| path within that domain are removed. If given three arguments, then
| the cookie with the specified name, path and domain is removed.
|
| Raises KeyError if no matching cookie exists.
|
| clear_expired_cookies(self)
| Discard all expired cookies.
|
| You probably don't need to call this method: expired cookies are never
| sent back to the server (provided you're using DefaultCookiePolicy),
| this method is called by CookieJar itself every so often, and the
| .save() method won't save expired cookies anyway (unless you ask
| otherwise by passing a true ignore_expires argument).
|
| clear_session_cookies(self)
| Discard all session cookies.
|
| Note that the .save() method won't save session cookies anyway, unless
| you ask otherwise by passing a true ignore_discard argument.
|
| extract_cookies(self, response, request)
| Extract cookies from response, where allowable given the request.
|
| make_cookies(self, response, request)
| Return sequence of Cookie objects extracted from response object.
|
| set_cookie_if_ok(self, cookie, request)
| Set a cookie if policy says it's OK to do so.
|
| set_policy(self, policy)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from http.cookiejar.CookieJar:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from http.cookiejar.CookieJar:
|
| domain_re = re.compile('[^.]*')
|
| dots_re = re.compile('^\\.+')
|
| magic_re = re.compile('^\\#LWP-Cookies-(\\d+\\.\\d+)', re.ASCII)
|
| non_word_re = re.compile('\\W')
|
| quote_re = re.compile('([\\"\\\\])')
|
| strict_domain_re = re.compile('\\.?[^.]*')
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| pop(self, key, default=<object object at 0x00000235A7DB81F0>)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
| If key is not found, d is returned if given, otherwise KeyError is raised.
|
| popitem(self)
| D.popitem() -> (k, v), remove and return some (key, value) pair
| as a 2-tuple; but raise KeyError if D is empty.
|
| setdefault(self, key, default=None)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __eq__(self, other)
| Return self==value.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __hash__ = None
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
FUNCTIONS
cookiejar_from_dict(cookie_dict: 'dict[str, str] | None', cookiejar: 'CookieJar | None' = None, overwrite: 'bool' = True) -> 'CookieJar'
Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not replace cookies
already in the jar with new ones.
:rtype: CookieJar
create_cookie(name: 'str', value: 'str', **kwargs: 'Any') -> 'Cookie'
Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie").
extract_cookies_to_jar(jar: 'CookieJar', request: 'PreparedRequest', response: 'Any') -> 'None'
Extract the cookies from the response into a CookieJar.
:param jar: http.cookiejar.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
get_cookie_header(jar: 'CookieJar', request: 'PreparedRequest') -> 'str | None'
Produce an appropriate Cookie header string to be sent with `request`, or None.
:rtype: str
merge_cookies(cookiejar: 'CookieJar', cookies: 'dict[str, str] | CookieJar | None') -> 'CookieJar'
Add cookies to cookiejar and returns a merged CookieJar.
:param cookiejar: CookieJar object to add the cookies to.
:param cookies: Dictionary or CookieJar object to be added.
:rtype: CookieJar
morsel_to_cookie(morsel: 'Morsel[Any]') -> 'Cookie'
Convert a Morsel object into a Cookie containing the one k/v pair.
remove_cookie_by_name(cookiejar: 'CookieJar', name: 'str', domain: 'str | None' = None, path: 'str | None' = None) -> 'None'
Unsets a cookie by name, by default over all domains and paths.
Wraps CookieJar.clear(), is O(n).
DATA
TYPE_CHECKING = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\cookies.py
requests.delete
Python Library Documentation: function delete in module requests.api
delete(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.exceptions
Python Library Documentation: module requests.exceptions in requests
NAME
requests.exceptions
DESCRIPTION
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
CLASSES
builtins.OSError(builtins.Exception)
RequestException
ChunkedEncodingError
ConnectionError
ConnectTimeout(ConnectionError, Timeout)
ProxyError
SSLError
ContentDecodingError(RequestException, urllib3.exceptions.HTTPError)
HTTPError
InvalidHeader(RequestException, builtins.ValueError)
InvalidJSONError
JSONDecodeError(InvalidJSONError, simplejson.errors.JSONDecodeError)
InvalidSchema(RequestException, builtins.ValueError)
InvalidURL(RequestException, builtins.ValueError)
InvalidProxyURL
MissingSchema(RequestException, builtins.ValueError)
RetryError
StreamConsumedError(RequestException, builtins.TypeError)
Timeout
ReadTimeout
TooManyRedirects
URLRequired
UnrewindableBodyError
builtins.Warning(builtins.Exception)
RequestsWarning
FileModeWarning(RequestsWarning, builtins.DeprecationWarning)
RequestsDependencyWarning
class ChunkedEncodingError(RequestException)
| ChunkedEncodingError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The server declared chunked encoding but sent an invalid chunk.
|
| Method resolution order:
| ChunkedEncodingError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ConnectTimeout(ConnectionError, Timeout)
| ConnectTimeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The request timed out while trying to connect to the remote server.
|
| Requests that produced this error are safe to retry.
|
| Method resolution order:
| ConnectTimeout
| ConnectionError
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ConnectionError(RequestException)
| ConnectionError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A Connection error occurred.
|
| Method resolution order:
| ConnectionError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ContentDecodingError(RequestException, urllib3.exceptions.HTTPError)
| ContentDecodingError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Failed to decode response content.
|
| Method resolution order:
| ContentDecodingError
| RequestException
| builtins.OSError
| urllib3.exceptions.HTTPError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FileModeWarning(RequestsWarning, builtins.DeprecationWarning)
| A file was opened in text mode, but Requests determined its binary length.
|
| Method resolution order:
| FileModeWarning
| RequestsWarning
| builtins.DeprecationWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from RequestsWarning:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.DeprecationWarning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.DeprecationWarning:
|
| __new__(*args, **kwargs) class method of builtins.DeprecationWarning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class HTTPError(RequestException)
| HTTPError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| An HTTP error occurred.
|
| Method resolution order:
| HTTPError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidHeader(RequestException, builtins.ValueError)
| InvalidHeader(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The header value provided was somehow invalid.
|
| Method resolution order:
| InvalidHeader
| RequestException
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidJSONError(RequestException)
| InvalidJSONError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A JSON error occurred.
|
| Method resolution order:
| InvalidJSONError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidProxyURL(InvalidURL)
| InvalidProxyURL(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The proxy URL provided is invalid.
|
| Method resolution order:
| InvalidProxyURL
| InvalidURL
| RequestException
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidSchema(RequestException, builtins.ValueError)
| InvalidSchema(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The URL scheme provided is either invalid or unsupported.
|
| Method resolution order:
| InvalidSchema
| RequestException
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidURL(RequestException, builtins.ValueError)
| InvalidURL(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The URL provided was somehow invalid.
|
| Method resolution order:
| InvalidURL
| RequestException
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class JSONDecodeError(InvalidJSONError, simplejson.errors.JSONDecodeError)
| JSONDecodeError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Couldn't decode the text into json
|
| Method resolution order:
| JSONDecodeError
| InvalidJSONError
| RequestException
| builtins.OSError
| simplejson.errors.JSONDecodeError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Construct the JSONDecodeError instance first with all
| args. Then use it's args to construct the IOError so that
| the json specific args aren't used as IOError specific args
| and the error message from JSONDecodeError is preserved.
|
| __reduce__(self) -> 'tuple[Any, ...] | str'
| The __reduce__ method called when pickling the object must
| be the one from the JSONDecodeError (be it json/simplejson)
| as it expects all the arguments for instantiation, not just
| one like the IOError, and the MRO would by default call the
| __reduce__ method from the IOError due to the inheritance order.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class MissingSchema(RequestException, builtins.ValueError)
| MissingSchema(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The URL scheme (e.g. http or https) is missing.
|
| Method resolution order:
| MissingSchema
| RequestException
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ProxyError(ConnectionError)
| ProxyError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A proxy error occurred.
|
| Method resolution order:
| ProxyError
| ConnectionError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ReadTimeout(Timeout)
| ReadTimeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The server did not send any data in the allotted amount of time.
|
| Method resolution order:
| ReadTimeout
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class RequestException(builtins.OSError)
| RequestException(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| There was an ambiguous exception that occurred while handling your
| request.
|
| Method resolution order:
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'request': 'Request | PreparedRequest | None', 'res...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class RequestsDependencyWarning(RequestsWarning)
| An imported dependency doesn't match the expected version range.
|
| Method resolution order:
| RequestsDependencyWarning
| RequestsWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors inherited from RequestsWarning:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Warning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Warning:
|
| __new__(*args, **kwargs) class method of builtins.Warning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class RequestsWarning(builtins.Warning)
| Base warning for Requests.
|
| Method resolution order:
| RequestsWarning
| builtins.Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Warning:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Warning:
|
| __new__(*args, **kwargs) class method of builtins.Warning
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class RetryError(RequestException)
| RetryError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Custom retries logic failed
|
| Method resolution order:
| RetryError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLError(ConnectionError)
| SSLError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| An SSL error occurred.
|
| Method resolution order:
| SSLError
| ConnectionError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class StreamConsumedError(RequestException, builtins.TypeError)
| StreamConsumedError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The content for this response was already consumed.
|
| Method resolution order:
| StreamConsumedError
| RequestException
| builtins.OSError
| builtins.TypeError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class Timeout(RequestException)
| Timeout(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| The request timed out.
|
| Catching this error will catch both
| :exc:`~requests.exceptions.ConnectTimeout` and
| :exc:`~requests.exceptions.ReadTimeout` errors.
|
| Method resolution order:
| Timeout
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class TooManyRedirects(RequestException)
| TooManyRedirects(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Too many redirects.
|
| Method resolution order:
| TooManyRedirects
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class URLRequired(RequestException)
| URLRequired(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| A valid URL is required to make a request.
|
| Method resolution order:
| URLRequired
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class UnrewindableBodyError(RequestException)
| UnrewindableBodyError(*args: 'Any', **kwargs: 'Any') -> 'None'
|
| Requests encountered an error when trying to rewind a body.
|
| Method resolution order:
| UnrewindableBodyError
| RequestException
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from RequestException:
|
| __init__(self, *args: 'Any', **kwargs: 'Any') -> 'None'
| Initialize RequestException with `request` and `response` objects.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestException:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
DATA
TYPE_CHECKING = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\exceptions.py
requests.get
Python Library Documentation: function get in module requests.api
get(url: '_t.UriType', params: '_t.ParamsType' = None, **kwargs: 'Unpack[_t.GetKwargs]') -> 'Response'
Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.head
Python Library Documentation: function head in module requests.api
head(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. If
`allow_redirects` is not provided, it will be set to `False` (as
opposed to the default :meth:`request` behavior).
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.hooks
Python Library Documentation: module requests.hooks in requests
NAME
requests.hooks
DESCRIPTION
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``response``:
The response generated from a Request.
FUNCTIONS
default_hooks() -> 'dict[str, list[_t.HookType]]'
dispatch_hook(key: 'str', hooks: '_t.HooksInputType | None', hook_data: 'Response', **kwargs: 'Any') -> 'Response'
Dispatches a hook dictionary on a given piece of data.
DATA
HOOKS = ['response']
TYPE_CHECKING = False
__annotations__ = {'HOOKS': 'list[str]'}
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\hooks.py
requests.logging
Python Library Documentation: package logging
NAME
logging
MODULE REFERENCE
https://docs.python.org/3.12/library/logging.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
PACKAGE CONTENTS
config
handlers
CLASSES
builtins.object
BufferingFormatter
Filter
Formatter
LogRecord
LoggerAdapter
Filterer(builtins.object)
Handler
NullHandler
StreamHandler
FileHandler
Logger
class BufferingFormatter(builtins.object)
| BufferingFormatter(linefmt=None)
|
| A formatter suitable for formatting a number of records.
|
| Methods defined here:
|
| __init__(self, linefmt=None)
| Optionally specify a formatter which will be used to format each
| individual record.
|
| format(self, records)
| Format the specified records and return the result as a string.
|
| formatFooter(self, records)
| Return the footer string for the specified records.
|
| formatHeader(self, records)
| Return the header string for the specified records.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class FileHandler(StreamHandler)
| FileHandler(filename, mode='a', encoding=None, delay=False, errors=None)
|
| A handler class which writes formatted logging records to disk files.
|
| Method resolution order:
| FileHandler
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename, mode='a', encoding=None, delay=False, errors=None)
| Open the specified file and use it as the stream for logging.
|
| __repr__(self)
| Return repr(self).
|
| close(self)
| Closes the stream.
|
| emit(self, record)
| Emit a record.
|
| If the stream was not opened because 'delay' was specified in the
| constructor, open it before calling the superclass's emit.
|
| If stream is not open, current mode is 'w' and `_closed=True`, record
| will not be emitted (see Issue #42378).
|
| ----------------------------------------------------------------------
| Methods inherited from StreamHandler:
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods inherited from StreamHandler:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from StreamHandler:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Filter(builtins.object)
| Filter(name='')
|
| Filter instances are used to perform arbitrary filtering of LogRecords.
|
| Loggers and Handlers can optionally use Filter instances to filter
| records as desired. The base filter class only allows events which are
| below a certain point in the logger hierarchy. For example, a filter
| initialized with "A.B" will allow events logged by loggers "A.B",
| "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
| initialized with the empty string, all events are passed.
|
| Methods defined here:
|
| __init__(self, name='')
| Initialize a filter.
|
| Initialize with the name of the logger which, together with its
| children, will have its events allowed through the filter. If no
| name is specified, allow every event.
|
| filter(self, record)
| Determine if the specified record is to be logged.
|
| Returns True if the record should be logged, or False otherwise.
| If deemed appropriate, the record may be modified in-place.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Formatter(builtins.object)
| Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
|
| Formatter instances are used to convert a LogRecord to text.
|
| Formatters need to know how a LogRecord is constructed. They are
| responsible for converting a LogRecord to (usually) a string which can
| be interpreted by either a human or an external system. The base Formatter
| allows a formatting string to be specified. If none is supplied, the
| style-dependent default value, "%(message)s", "{message}", or
| "${message}", is used.
|
| The Formatter can be initialized with a format string which makes use of
| knowledge of the LogRecord attributes - e.g. the default value mentioned
| above makes use of the fact that the user's message and arguments are pre-
| formatted into a LogRecord's message attribute. Currently, the useful
| attributes in a LogRecord are described by:
|
| %(name)s Name of the logger (logging channel)
| %(levelno)s Numeric logging level for the message (DEBUG, INFO,
| WARNING, ERROR, CRITICAL)
| %(levelname)s Text logging level for the message ("DEBUG", "INFO",
| "WARNING", "ERROR", "CRITICAL")
| %(pathname)s Full pathname of the source file where the logging
| call was issued (if available)
| %(filename)s Filename portion of pathname
| %(module)s Module (name portion of filename)
| %(lineno)d Source line number where the logging call was issued
| (if available)
| %(funcName)s Function name
| %(created)f Time when the LogRecord was created (time.time()
| return value)
| %(asctime)s Textual time when the LogRecord was created
| %(msecs)d Millisecond portion of the creation time
| %(relativeCreated)d Time in milliseconds when the LogRecord was created,
| relative to the time the logging module was loaded
| (typically at application startup time)
| %(thread)d Thread ID (if available)
| %(threadName)s Thread name (if available)
| %(taskName)s Task name (if available)
| %(process)d Process ID (if available)
| %(message)s The result of record.getMessage(), computed just as
| the record is emitted
|
| Methods defined here:
|
| __init__(self, fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)
| Initialize the formatter with specified format strings.
|
| Initialize the formatter either with the specified format string, or a
| default as described above. Allow for specialized date formatting with
| the optional datefmt argument. If datefmt is omitted, you get an
| ISO8601-like (or RFC 3339-like) format.
|
| Use a style parameter of '%', '{' or '$' to specify that you want to
| use one of %-formatting, :meth:`str.format` (``{}``) formatting or
| :class:`string.Template` formatting in your format string.
|
| .. versionchanged:: 3.2
| Added the ``style`` parameter.
|
| format(self, record)
| Format the specified record as text.
|
| The record's attribute dictionary is used as the operand to a
| string formatting operation which yields the returned string.
| Before formatting the dictionary, a couple of preparatory steps
| are carried out. The message attribute of the record is computed
| using LogRecord.getMessage(). If the formatting string uses the
| time (as determined by a call to usesTime(), formatTime() is
| called to format the event time. If there is exception information,
| it is formatted using formatException() and appended to the message.
|
| formatException(self, ei)
| Format and return the specified exception information as a string.
|
| This default implementation just uses
| traceback.print_exception()
|
| formatMessage(self, record)
|
| formatStack(self, stack_info)
| This method is provided as an extension point for specialized
| formatting of stack information.
|
| The input data is a string as returned from a call to
| :func:`traceback.print_stack`, but with the last trailing newline
| removed.
|
| The base implementation just returns the value passed in.
|
| formatTime(self, record, datefmt=None)
| Return the creation time of the specified LogRecord as formatted text.
|
| This method should be called from format() by a formatter which
| wants to make use of a formatted time. This method can be overridden
| in formatters to provide for any specific requirement, but the
| basic behaviour is as follows: if datefmt (a string) is specified,
| it is used with time.strftime() to format the creation time of the
| record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.
| The resulting string is returned. This function uses a user-configurable
| function to convert the creation time to a tuple. By default,
| time.localtime() is used; to change this for a particular formatter
| instance, set the 'converter' attribute to a function with the same
| signature as time.localtime() or time.gmtime(). To change it for all
| formatters, for example if you want all logging times to be shown in GMT,
| set the 'converter' attribute in the Formatter class.
|
| usesTime(self)
| Check if the format uses the creation time of the record.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| converter = localtime(...)
| localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
| tm_sec,tm_wday,tm_yday,tm_isdst)
|
| Convert seconds since the Epoch to a time tuple expressing local time.
| When 'seconds' is not passed in, convert the current time instead.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| default_msec_format = '%s,%03d'
|
| default_time_format = '%Y-%m-%d %H:%M:%S'
class Handler(Filterer)
| Handler(level=0)
|
| Handler instances dispatch logging events to specific destinations.
|
| The base handler class. Acts as a placeholder which defines the Handler
| interface. Handlers can optionally use Formatter instances to format
| records as desired. By default, no formatter is specified; in this case,
| the 'raw' message as determined by record.message is logged.
|
| Method resolution order:
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Do whatever it takes to actually log the specified logging record.
|
| This version is intended to be implemented by subclasses and so
| raises a NotImplementedError.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LogRecord(builtins.object)
| LogRecord(name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
|
| A LogRecord instance represents an event being logged.
|
| LogRecord instances are created every time something is logged. They
| contain all the information pertinent to the event being logged. The
| main information passed in is in msg and args, which are combined
| using str(msg) % args to create the message field of the record. The
| record also includes information such as when the record was created,
| the source line where the logging call was made, and any exception
| information to be logged.
|
| Methods defined here:
|
| __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs)
| Initialize a logging record with interesting information.
|
| __repr__(self)
| Return repr(self).
|
| getMessage(self)
| Return the message for this LogRecord.
|
| Return the message for this LogRecord after merging any user-supplied
| arguments with the message.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Logger(Filterer)
| Logger(name, level=0)
|
| Instances of the Logger class represent a single logging channel. A
| "logging channel" indicates an area of an application. Exactly how an
| "area" is defined is up to the application developer. Since an
| application can have any number of areas, logging channels are identified
| by a unique string. Application areas can be nested (e.g. an area
| of "input processing" might include sub-areas "read CSV files", "read
| XLS files" and "read Gnumeric files"). To cater for this natural nesting,
| channel names are organized into a namespace hierarchy where levels are
| separated by periods, much like the Java or Python package namespace. So
| in the instance given above, channel names might be "input" for the upper
| level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
| There is no arbitrary limit to the depth of nesting.
|
| Method resolution order:
| Logger
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, name, level=0)
| Initialize the logger with a name and an optional level.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| addHandler(self, hdlr)
| Add the specified handler to this logger.
|
| callHandlers(self, record)
| Pass a record to all relevant handlers.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. If no handler was found, output a one-off error
| message to sys.stderr. Stop searching up the hierarchy whenever a
| logger with the "propagate" attribute set to zero is found - that
| will be the last logger whose handlers are called.
|
| critical(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'CRITICAL'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
|
| debug(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'DEBUG'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
|
| error(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'ERROR'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.error("Houston, we have a %s", "major problem", exc_info=True)
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Convenience method for logging an ERROR with exception information.
|
| fatal(self, msg, *args, **kwargs)
| Don't use this method, use critical() instead.
|
| findCaller(self, stack_info=False, stacklevel=1)
| Find the stack frame of the caller so that we can note the source
| file name, line number and function name.
|
| getChild(self, suffix)
| Get a logger which is a descendant to this one.
|
| This is a convenience method, such that
|
| logging.getLogger('abc').getChild('def.ghi')
|
| is the same as
|
| logging.getLogger('abc.def.ghi')
|
| It's useful, for example, when the parent logger is named using
| __name__ rather than a literal string.
|
| getChildren(self)
|
| getEffectiveLevel(self)
| Get the effective level for this logger.
|
| Loop through this logger and its parents in the logger hierarchy,
| looking for a non-zero logging level. Return the first one found.
|
| handle(self, record)
| Call the handlers for the specified record.
|
| This method is used for unpickled records received from a socket, as
| well as those created locally. Logger-level filtering is applied.
|
| hasHandlers(self)
| See if this logger has any handlers configured.
|
| Loop through all handlers for this logger and its parents in the
| logger hierarchy. Return True if a handler was found, else False.
| Stop searching up the hierarchy whenever a logger with the "propagate"
| attribute set to zero is found - that will be the last logger which
| is checked for the existence of handlers.
|
| info(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'INFO'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.info("Houston, we have a %s", "notable problem", exc_info=True)
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Log 'msg % args' with the integer severity 'level'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
|
| makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
| A factory method which can be overridden in subclasses to create
| specialized LogRecords.
|
| removeHandler(self, hdlr)
| Remove the specified handler from this logger.
|
| setLevel(self, level)
| Set the logging level of this logger. level must be an int or a str.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Log 'msg % args' with severity 'WARNING'.
|
| To pass exception information, use the keyword argument exc_info with
| a true value, e.g.
|
| logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| manager = <logging.Manager object>
|
| root = <RootLogger root (WARNING)>
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class LoggerAdapter(builtins.object)
| LoggerAdapter(logger, extra=None)
|
| An adapter for loggers which makes it easier to specify contextual
| information in logging output.
|
| Methods defined here:
|
| __init__(self, logger, extra=None)
| Initialize the adapter with a logger and a dict-like object which
| provides contextual information. This constructor signature allows
| easy stacking of LoggerAdapters, if so desired.
|
| You can effectively pass keyword arguments as shown in the
| following example:
|
| adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2"))
|
| __repr__(self)
| Return repr(self).
|
| critical(self, msg, *args, **kwargs)
| Delegate a critical call to the underlying logger.
|
| debug(self, msg, *args, **kwargs)
| Delegate a debug call to the underlying logger.
|
| error(self, msg, *args, **kwargs)
| Delegate an error call to the underlying logger.
|
| exception(self, msg, *args, exc_info=True, **kwargs)
| Delegate an exception call to the underlying logger.
|
| getEffectiveLevel(self)
| Get the effective level for the underlying logger.
|
| hasHandlers(self)
| See if the underlying logger has any handlers.
|
| info(self, msg, *args, **kwargs)
| Delegate an info call to the underlying logger.
|
| isEnabledFor(self, level)
| Is this logger enabled for level 'level'?
|
| log(self, level, msg, *args, **kwargs)
| Delegate a log call to the underlying logger, after adding
| contextual information from this adapter instance.
|
| process(self, msg, kwargs)
| Process the logging message and keyword arguments passed in to
| a logging call to insert contextual information. You can either
| manipulate the message itself, the keyword args or both. Return
| the message and kwargs modified (or not) to suit your needs.
|
| Normally, you'll only need to override this one method in a
| LoggerAdapter subclass for your specific needs.
|
| setLevel(self, level)
| Set the specified level on the underlying logger.
|
| warn(self, msg, *args, **kwargs)
|
| warning(self, msg, *args, **kwargs)
| Delegate a warning call to the underlying logger.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| manager
class NullHandler(Handler)
| NullHandler(level=0)
|
| This handler does nothing. It's intended to be used to avoid the
| "No handlers could be found for logger XXX" one-off warning. This is
| important for library code, which may contain code to log events. If a user
| of the library does not configure logging, the one-off warning might be
| produced; to avoid this, the library developer simply needs to instantiate
| a NullHandler and add it to the top-level logger of the library module or
| package.
|
| Method resolution order:
| NullHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| emit(self, record)
| Stub.
|
| handle(self, record)
| Stub.
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| __init__(self, level=0)
| Initializes the instance - basically setting the formatter to None
| and the filter list to empty.
|
| __repr__(self)
| Return repr(self).
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| flush(self)
| Ensure all logging output has been flushed.
|
| This version does nothing and is intended to be implemented by
| subclasses.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class StreamHandler(Handler)
| StreamHandler(stream=None)
|
| A handler class which writes logging records, appropriately formatted,
| to a stream. Note that this class does not close the stream, as
| sys.stdout or sys.stderr may be used.
|
| Method resolution order:
| StreamHandler
| Handler
| Filterer
| builtins.object
|
| Methods defined here:
|
| __init__(self, stream=None)
| Initialize the handler.
|
| If stream is not specified, sys.stderr is used.
|
| __repr__(self)
| Return repr(self).
|
| emit(self, record)
| Emit a record.
|
| If a formatter is specified, it is used to format the record.
| The record is then written to the stream with a trailing newline. If
| exception information is present, it is formatted using
| traceback.print_exception and appended to the stream. If the stream
| has an 'encoding' attribute, it is used to determine how to do the
| output to the stream.
|
| flush(self)
| Flushes the stream.
|
| setStream(self, stream)
| Sets the StreamHandler's stream to the specified value,
| if it is different.
|
| Returns the old stream, if the stream was changed, or None
| if it wasn't.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| terminator = '\n'
|
| ----------------------------------------------------------------------
| Methods inherited from Handler:
|
| acquire(self)
| Acquire the I/O thread lock.
|
| close(self)
| Tidy up any resources used by the handler.
|
| This version removes the handler from an internal map of handlers,
| _handlers, which is used for handler lookup by name. Subclasses
| should ensure that this gets called from overridden close()
| methods.
|
| createLock(self)
| Acquire a thread lock for serializing access to the underlying I/O.
|
| format(self, record)
| Format the specified record.
|
| If a formatter is set, use it. Otherwise, use the default formatter
| for the module.
|
| get_name(self)
|
| handle(self, record)
| Conditionally emit the specified logging record.
|
| Emission depends on filters which may have been added to the handler.
| Wrap the actual emission of the record with acquisition/release of
| the I/O thread lock.
|
| Returns an instance of the log record that was emitted
| if it passed all filters, otherwise a false value is returned.
|
| handleError(self, record)
| Handle errors which occur during an emit() call.
|
| This method should be called from handlers when an exception is
| encountered during an emit() call. If raiseExceptions is false,
| exceptions get silently ignored. This is what is mostly wanted
| for a logging system - most users will not care about errors in
| the logging system, they are more interested in application errors.
| You could, however, replace this with a custom handler if you wish.
| The record which was being processed is passed in to this method.
|
| release(self)
| Release the I/O thread lock.
|
| setFormatter(self, fmt)
| Set the formatter for this handler.
|
| setLevel(self, level)
| Set the logging level of this handler. level must be an int or a str.
|
| set_name(self, name)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Handler:
|
| name
|
| ----------------------------------------------------------------------
| Methods inherited from Filterer:
|
| addFilter(self, filter)
| Add the specified filter to this handler.
|
| filter(self, record)
| Determine if a record is loggable by consulting all the filters.
|
| The default is to allow the record to be logged; any filter can veto
| this by returning a false value.
| If a filter attached to a handler returns a log record instance,
| then that instance is used in place of the original log record in
| any further processing of the event by that handler.
| If a filter returns any other true value, the original log record
| is used in any further processing of the event by that handler.
|
| If none of the filters return false values, this method returns
| a log record.
| If any of the filters return a false value, this method returns
| a false value.
|
| .. versionchanged:: 3.2
|
| Allow filters to be just callables.
|
| .. versionchanged:: 3.12
| Allow filters to return a LogRecord instead of
| modifying it in place.
|
| removeFilter(self, filter)
| Remove the specified filter from this handler.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Filterer:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
addLevelName(level, levelName)
Associate 'levelName' with 'level'.
This is used when converting levels to text during message formatting.
basicConfig(**kwargs)
Do basic configuration for the logging system.
This function does nothing if the root logger already has handlers
configured, unless the keyword argument *force* is set to ``True``.
It is a convenience method intended for use by simple scripts
to do one-shot configuration of the logging package.
The default behaviour is to create a StreamHandler which writes to
sys.stderr, set a formatter using the BASIC_FORMAT format string, and
add the handler to the root logger.
A number of optional keyword arguments may be specified, which can alter
the default behaviour.
filename Specifies that a FileHandler be created, using the specified
filename, rather than a StreamHandler.
filemode Specifies the mode to open the file, if filename is specified
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
style If a format string is specified, use this to specify the
type of format string (possible values '%', '{', '$', for
%-formatting, :meth:`str.format` and :class:`string.Template`
- defaults to '%').
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
are present, 'stream' is ignored.
handlers If specified, this should be an iterable of already created
handlers, which will be added to the root logger. Any handler
in the list which does not have a formatter assigned will be
assigned the formatter created in this function.
force If this keyword is specified as true, any existing handlers
attached to the root logger are removed and closed, before
carrying out the configuration as specified by the other
arguments.
encoding If specified together with a filename, this encoding is passed to
the created FileHandler, causing it to be used when the file is
opened.
errors If specified together with a filename, this value is passed to the
created FileHandler, causing it to be used when the file is
opened in text mode. If not specified, the default value is
`backslashreplace`.
Note that you could specify a stream created using open(filename, mode)
rather than passing the filename and mode in. However, it should be
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
.. versionchanged:: 3.2
Added the ``style`` parameter.
.. versionchanged:: 3.3
Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
incompatible arguments (e.g. ``handlers`` specified together with
``filename``/``filemode``, or ``filename``/``filemode`` specified
together with ``stream``, or ``handlers`` specified together with
``stream``.
.. versionchanged:: 3.8
Added the ``force`` parameter.
.. versionchanged:: 3.9
Added the ``encoding`` and ``errors`` parameters.
captureWarnings(capture)
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
critical(msg, *args, **kwargs)
Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.
debug(msg, *args, **kwargs)
Log a message with severity 'DEBUG' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
disable(level=50)
Disable all logging calls of severity 'level' and below.
error(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
exception(msg, *args, exc_info=True, **kwargs)
Log a message with severity 'ERROR' on the root logger, with exception
information. If the logger has no handlers, basicConfig() is called to add
a console handler with a pre-defined format.
fatal(msg, *args, **kwargs)
Don't use this function, use critical() instead.
getHandlerByName(name)
Get a handler with the specified *name*, or None if there isn't one with
that name.
getHandlerNames()
Return all known handler names as an immutable set.
getLevelName(level)
Return the textual or numeric representation of logging level 'level'.
If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
INFO, DEBUG) then you get the corresponding string. If you have
associated levels with names using addLevelName then the name you have
associated with 'level' is returned.
If a numeric value corresponding to one of the defined levels is passed
in, the corresponding string representation is returned.
If a string representation of the level is passed in, the corresponding
numeric value is returned.
If no matching numeric or string value is passed in, the string
'Level %s' % level is returned.
getLevelNamesMapping()
getLogRecordFactory()
Return the factory to be used when instantiating a log record.
getLogger(name=None)
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
getLoggerClass()
Return the class to be used when instantiating a logger.
info(msg, *args, **kwargs)
Log a message with severity 'INFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
log(level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level' on the root logger. If
the logger has no handlers, call basicConfig() to add a console handler
with a pre-defined format.
makeLogRecord(dict)
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
setLogRecordFactory(factory)
Set the factory to be used when instantiating a log record.
:param factory: A callable which will be called to instantiate
a log record.
setLoggerClass(klass)
Set the class to be used when instantiating a logger. The class should
define __init__() such that only a name argument is required, and the
__init__() should call Logger.__init__()
shutdown(handlerList=[<weakref at 0x00000235A8B36D90; to '_StderrHandler' at 0x00000235A8B33440>, <weakref at 0x00000235A8B131A0; to 'NullHandler' at 0x00000235A8CBFC80>, <weakref at 0x00000235AA5B31F0; to 'StreamHandler' at 0x00000235AA5C2390>, <weakref at 0x00000235AA612D90; to 'NullHandler' at 0x00000235AA5C1C70>, <weakref at 0x00000235AA5B2700; to 'NullHandler' at 0x00000235A8655AC0>])
Perform any cleanup actions in the logging system (e.g. flushing
buffers).
Should be called at application exit.
warn(msg, *args, **kwargs)
warning(msg, *args, **kwargs)
Log a message with severity 'WARNING' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with a pre-defined
format.
DATA
BASIC_FORMAT = '%(levelname)s:%(name)s:%(message)s'
CRITICAL = 50
DEBUG = 10
ERROR = 40
FATAL = 50
INFO = 20
NOTSET = 0
WARN = 30
WARNING = 30
__all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', ...
__status__ = 'production'
lastResort = <_StderrHandler <stderr> (WARNING)>
raiseExceptions = True
VERSION
0.5.1.2
DATE
07 February 2010
AUTHOR
Vinay Sajip <vinay_sajip@red-dove.com>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\logging\__init__.py
requests.models
Python Library Documentation: module requests.models in requests
NAME
requests.models
DESCRIPTION
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
CLASSES
builtins.object
RequestEncodingMixin
PreparedRequest(RequestEncodingMixin, RequestHooksMixin)
RequestHooksMixin
Request
Response
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin)
| PreparedRequest() -> 'None'
|
| The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
| containing the exact bytes that will be sent to the server.
|
| Instances are generated from a :class:`Request <Request>` object, and
| should not be instantiated manually; doing so may produce undesirable
| effects.
|
| Usage::
|
| >>> import requests
| >>> req = requests.Request('GET', 'https://httpbin.org/get')
| >>> r = req.prepare()
| >>> r
| <PreparedRequest [GET]>
|
| >>> s = requests.Session()
| >>> s.send(r)
| <Response [200]>
|
| Method resolution order:
| PreparedRequest
| RequestEncodingMixin
| RequestHooksMixin
| builtins.object
|
| Methods defined here:
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| copy(self) -> 'PreparedRequest'
|
| prepare(self, method: 'str | None' = None, url: '_t.UriType | None' = None, headers: 'Mapping[str, str | bytes] | None' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
| Prepares the entire request with the given parameters.
|
| prepare_auth(self, auth: '_t.AuthType', url: '_t.UriType' = '') -> 'None'
| Prepares the given HTTP auth data.
|
| prepare_body(self, data: '_t.DataType', files: '_t.FilesType', json: '_t.JsonType' = None) -> 'None'
| Prepares the given HTTP body data.
|
| prepare_content_length(self, body: '_t.BodyType') -> 'None'
| Prepare Content-Length header based on request method and body
|
| prepare_cookies(self, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None') -> 'None'
| Prepares the given HTTP cookie data.
|
| This function eventually generates a ``Cookie`` header from the
| given cookies using cookielib. Due to cookielib's design, the header
| will not be regenerated if it already exists, meaning this function
| can only be called once for the life of the
| :class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
| to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
| header is removed beforehand.
|
| prepare_headers(self, headers: 'Mapping[str, str | bytes] | None') -> 'None'
| Prepares the given HTTP headers.
|
| prepare_hooks(self, hooks: '_t.HooksInputType | None') -> 'None'
| Prepares the given hooks.
|
| prepare_method(self, method: 'str | None') -> 'None'
| Prepares the given HTTP method.
|
| prepare_url(self, url: '_t.UriType', params: '_t.ParamsType') -> 'None'
| Prepares the given HTTP URL.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'_body_position': 'int | object | None', '_cookies'...
|
| ----------------------------------------------------------------------
| Readonly properties inherited from RequestEncodingMixin:
|
| path_url
| Build the path URL to use.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestEncodingMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from RequestHooksMixin:
|
| deregister_hook(self, event: 'str', hook: '_t.HookType') -> 'bool'
| Deregister a previously registered hook.
| Returns True if the hook existed, False if not.
|
| register_hook(self, event: 'str', hook: 'Iterable[_t.HookType] | _t.HookType') -> 'None'
| Properly register a hook.
class Request(RequestHooksMixin)
| Request(method: 'str | None' = None, url: '_t.UriType | None' = None, headers: '_t.HeadersType' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
|
| A user-created :class:`Request <Request>` object.
|
| Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
|
| :param method: HTTP method to use.
| :param url: URL to send.
| :param headers: dictionary of headers to send.
| :param files: dictionary of {filename: fileobject} files to multipart upload.
| :param data: the body to attach to the request. If a dictionary or
| list of tuples ``[(key, value)]`` is provided, form-encoding will
| take place.
| :param json: json for the body to attach to the request (if files or data is not specified).
| :param params: URL parameters to append to the URL. If a dictionary or
| list of tuples ``[(key, value)]`` is provided, form-encoding will
| take place.
| :param auth: Auth handler or (user, pass) tuple.
| :param cookies: dictionary or CookieJar of cookies to attach to this request.
| :param hooks: dictionary of callback hooks, for internal usage.
|
| Usage::
|
| >>> import requests
| >>> req = requests.Request('GET', 'https://httpbin.org/get')
| >>> req.prepare()
| <PreparedRequest [GET]>
|
| Method resolution order:
| Request
| RequestHooksMixin
| builtins.object
|
| Methods defined here:
|
| __init__(self, method: 'str | None' = None, url: '_t.UriType | None' = None, headers: '_t.HeadersType' = None, files: '_t.FilesType' = None, data: '_t.DataType' = None, params: '_t.ParamsType' = None, auth: '_t.AuthType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, json: '_t.JsonType' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| prepare(self) -> 'PreparedRequest'
| Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'auth': '_t.AuthType', 'cookies': 'RequestsCookieJa...
|
| ----------------------------------------------------------------------
| Methods inherited from RequestHooksMixin:
|
| deregister_hook(self, event: 'str', hook: '_t.HookType') -> 'bool'
| Deregister a previously registered hook.
| Returns True if the hook existed, False if not.
|
| register_hook(self, event: 'str', hook: 'Iterable[_t.HookType] | _t.HookType') -> 'None'
| Properly register a hook.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from RequestHooksMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class RequestEncodingMixin(builtins.object)
| Readonly properties defined here:
|
| path_url
| Build the path URL to use.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'url': 'str | None'}
class RequestHooksMixin(builtins.object)
| Methods defined here:
|
| deregister_hook(self, event: 'str', hook: '_t.HookType') -> 'bool'
| Deregister a previously registered hook.
| Returns True if the hook existed, False if not.
|
| register_hook(self, event: 'str', hook: 'Iterable[_t.HookType] | _t.HookType') -> 'None'
| Properly register a hook.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'hooks': 'dict[str, list[_t.HookType]]'}
class Response(builtins.object)
| Response() -> 'None'
|
| The :class:`Response <Response>` object, which contains a
| server's response to an HTTP request.
|
| Methods defined here:
|
| __bool__(self) -> 'bool'
| Returns True if :attr:`status_code` is less than 400.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code, is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| __enter__(self) -> 'Self'
|
| __exit__(self, *args: 'Any') -> 'None'
|
| __getstate__(self) -> 'dict[str, Any]'
| Helper for pickle.
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[bytes]'
| Allows you to use a response as an iterator.
|
| __nonzero__(self) -> 'bool'
| Returns True if :attr:`status_code` is less than 400.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code, is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
|
| close(self) -> 'None'
| Releases the connection back to the pool. Once this method has been
| called the underlying ``raw`` object must not be accessed again.
|
| *Note: Should not normally need to be called explicitly.*
|
| iter_content(self, chunk_size: 'int | None' = 1, decode_unicode: 'bool' = False) -> 'Iterator[str | bytes]'
| Iterates over the response data. When stream=True is set on the
| request, this avoids reading the content at once into memory for
| large responses. The chunk size is the number of bytes it should
| read into memory. This is not necessarily the length of each item
| returned as decoding can take place.
|
| chunk_size must be of type int or None. A value of None will
| function differently depending on the value of `stream`.
| stream=True will read data as it arrives in whatever size the
| chunks are received. If stream=False, data is returned as
| a single chunk.
|
| If decode_unicode is True, content will be decoded using encoding
| information from the response. If no encoding information is available,
| bytes will be returned. This can be bypassed by manually setting
| `encoding` on the response.
|
| iter_lines(self, chunk_size: 'int' = 512, decode_unicode: 'bool' = False, delimiter: 'str | bytes | None' = None) -> 'Iterator[str | bytes]'
| Iterates over the response data, one line at a time. When
| stream=True is set on the request, this avoids reading the
| content at once into memory for large responses.
|
| The decode_unicode param works the same as in `iter_content`, with the
| same caveats.
|
| .. note:: This method is not reentrant safe.
|
| json(self, **kwargs: 'Any') -> 'Any'
| Decodes the JSON response body (if any) as a Python object.
|
| This may return a dictionary, list, etc. depending on what is in the response.
|
| :param \*\*kwargs: Optional arguments that ``json.loads`` takes.
| :raises requests.exceptions.JSONDecodeError: If the response body does not
| contain valid json.
|
| raise_for_status(self) -> 'None'
| Raises :class:`HTTPError`, if one occurred.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| apparent_encoding
| The apparent encoding, provided by the charset_normalizer or chardet libraries.
|
| content
| Content of the response, in bytes.
|
| is_permanent_redirect
| True if this Response one of the permanent versions of redirect.
|
| is_redirect
| True if this Response is a well-formed HTTP redirect that could have
| been processed automatically (by :meth:`Session.resolve_redirects`).
|
| links
| Returns the parsed header links of the response, if any.
|
| next
| Returns a PreparedRequest for the next request in a redirect chain, if there is one.
|
| ok
| Returns True if :attr:`status_code` is less than 400, False if not.
|
| This attribute checks if the status code of the response is between
| 400 and 600 to see if there was a client error or a server error. If
| the status code is between 200 and 400, this will return True. This
| is **not** a check to see if the response code is ``200 OK``.
|
| text
| Content of the response, in unicode.
|
| If Response.encoding is None, encoding will be guessed using
| ``charset_normalizer`` or ``chardet``.
|
| The encoding of the response content is determined based solely on HTTP
| headers, following RFC 2616 to the letter. If you can take advantage of
| non-HTTP knowledge to make a better guess at the encoding, you should
| set ``r.encoding`` appropriately before accessing this property.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'__attrs__': 'list[str]', '_content': 'bytes | Lite...
|
| __attrs__ = ['_content', 'status_code', 'headers', 'url', 'history', '...
DATA
CONTENT_CHUNK_SIZE = 10240
DEFAULT_REDIRECT_LIMIT = 30
Final = typing.Final
Special typing construct to indicate final names to type checkers.
A final name cannot be re-assigned or overridden in a subclass.
For example::
MAX_SIZE: Final = 9000
MAX_SIZE += 1 # Error reported by type checker
class Connection:
TIMEOUT: Final[int] = 10
class FastConnector(Connection):
TIMEOUT = 1 # Error reported by type checker
There is no runtime checking of these properties.
ITER_CHUNK_SIZE = 512
Literal = typing.Literal
Special typing form to define literal types (a.k.a. value types).
This form can be used to indicate to type checkers that the corresponding
variable or function parameter has a value equivalent to the provided
literal (or one of several literals)::
def validate_simple(data: Any) -> Literal[True]: # always returns True
...
MODE = Literal['r', 'rb', 'w', 'wb']
def open_helper(file: str, mode: MODE) -> str:
...
open_helper('/some/path', 'r') # Passes type check
open_helper('/other/path', 'typo') # Error in type checker
Literal[...] cannot be subclassed. At runtime, an arbitrary value
is allowed as type argument to Literal[...], but type checkers may
impose restrictions.
REDIRECT_STATI = (301, 302, 303, 307, 308)
TYPE_CHECKING = False
__annotations__ = {'CONTENT_CHUNK_SIZE': 'int', 'DEFAULT_REDIRECT_LIMI...
basestring = (<class 'str'>, <class 'bytes'>)
codes = <lookup 'status_codes'>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\models.py
requests.options
Python Library Documentation: function options in module requests.api
options(url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Sends an OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.packages
Python Library Documentation: module requests.packages in requests
NAME
requests.packages
DATA
mod = 'requests.packages.idna'
package = 'idna'
target = 'charset_normalizer'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\packages.py
requests.patch
Python Library Documentation: function patch in module requests.api
patch(url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.post
Python Library Documentation: function post in module requests.api
post(url: '_t.UriType', data: '_t.DataType' = None, json: '_t.JsonType' = None, **kwargs: 'Unpack[_t.PostKwargs]') -> 'Response'
Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.put
Python Library Documentation: function put in module requests.api
put(url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
requests.request
Python Library Documentation: function request in module requests.api
request(method: 'str', url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
in the query string for the :class:`Request`.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content_type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
to add for the file.
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How many seconds to wait for the server to send data
before giving up, as a float, or a :ref:`(connect timeout, read
timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
:return: :class:`Response <Response>` object
:rtype: requests.Response
Usage::
>>> import requests
>>> req = requests.request('GET', 'https://httpbin.org/get')
>>> req
<Response [200]>
requests.session
Python Library Documentation: function session in module requests.sessions
session() -> 'Session'
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be removed at a future date.
:rtype: Session
requests.sessions
Python Library Documentation: module requests.sessions in requests
NAME
requests.sessions
DESCRIPTION
requests.sessions
~~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
CLASSES
builtins.object
SessionRedirectMixin
Session
class Session(SessionRedirectMixin)
| Session() -> 'None'
|
| A Requests session.
|
| Provides cookie persistence, connection-pooling, and configuration.
|
| Basic Usage::
|
| >>> import requests
| >>> s = requests.Session()
| >>> s.get('https://httpbin.org/get')
| <Response [200]>
|
| Or as a context manager::
|
| >>> with requests.Session() as s:
| ... s.get('https://httpbin.org/get')
| <Response [200]>
|
| Method resolution order:
| Session
| SessionRedirectMixin
| builtins.object
|
| Methods defined here:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, *args: 'Any') -> 'None'
|
| __getstate__(self) -> 'dict[str, Any]'
| Helper for pickle.
|
| __init__(self) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __setstate__(self, state: 'dict[str, Any]') -> 'None'
|
| close(self) -> 'None'
| Closes all adapters and as such the session
|
| delete(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a DELETE request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| get(self, url: '_t.UriType', params: '_t.ParamsType' = None, **kwargs: 'Unpack[_t.GetKwargs]') -> 'Response'
| Sends a GET request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param params: (optional) Dictionary, list of tuples or bytes to send
| in the query string for the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| get_adapter(self, url: 'str') -> 'BaseAdapter'
| Returns the appropriate connection adapter for the given URL.
|
| :rtype: requests.adapters.BaseAdapter
|
| head(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a HEAD request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| merge_environment_settings(self, url: 'str', proxies: 'dict[str, str] | None', stream: 'bool | None', verify: '_t.VerifyType | None', cert: '_t.CertType') -> 'dict[str, Any]'
| Check the environment and merge it with some settings.
|
| :rtype: dict
|
| mount(self, prefix: 'str', adapter: 'BaseAdapter') -> 'None'
| Registers a connection adapter to a prefix.
|
| Adapters are sorted in descending order by prefix length.
|
| options(self, url: '_t.UriType', **kwargs: 'Unpack[_t.RequestKwargs]') -> 'Response'
| Sends a OPTIONS request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| patch(self, url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
| Sends a PATCH request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| post(self, url: '_t.UriType', data: '_t.DataType' = None, json: '_t.JsonType' = None, **kwargs: 'Unpack[_t.PostKwargs]') -> 'Response'
| Sends a POST request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param json: (optional) json to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| prepare_request(self, request: 'Request') -> 'PreparedRequest'
| Constructs a :class:`PreparedRequest <PreparedRequest>` for
| transmission and returns it. The :class:`PreparedRequest` has settings
| merged from the :class:`Request <Request>` instance and those of the
| :class:`Session`.
|
| :param request: :class:`Request` instance to prepare with this
| session's settings.
| :rtype: requests.PreparedRequest
|
| put(self, url: '_t.UriType', data: '_t.DataType' = None, **kwargs: 'Unpack[_t.DataKwargs]') -> 'Response'
| Sends a PUT request. Returns :class:`Response` object.
|
| :param url: URL for the new :class:`Request` object.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param \*\*kwargs: Optional arguments that ``request`` takes.
| :rtype: requests.Response
|
| request(self, method: 'str', url: '_t.UriType', params: '_t.ParamsType' = None, data: '_t.DataType' = None, headers: '_t.HeadersType' = None, cookies: 'RequestsCookieJar | CookieJar | dict[str, str] | None' = None, files: '_t.FilesType' = None, auth: '_t.AuthType' = None, timeout: '_t.TimeoutType' = None, allow_redirects: 'bool' = True, proxies: 'dict[str, str] | None' = None, hooks: '_t.HooksInputType | None' = None, stream: 'bool | None' = None, verify: '_t.VerifyType | None' = None, cert: '_t.CertType' = None, json: '_t.JsonType' = None) -> 'Response'
| Constructs a :class:`Request <Request>`, prepares it and sends it.
| Returns :class:`Response <Response>` object.
|
| :param method: method for the new :class:`Request` object.
| :param url: URL for the new :class:`Request` object.
| :param params: (optional) Dictionary or bytes to be sent in the query
| string for the :class:`Request`.
| :param data: (optional) Dictionary, list of tuples, bytes, or file-like
| object to send in the body of the :class:`Request`.
| :param json: (optional) json to send in the body of the
| :class:`Request`.
| :param headers: (optional) Dictionary of HTTP Headers to send with the
| :class:`Request`.
| :param cookies: (optional) Dict or CookieJar object to send with the
| :class:`Request`.
| :param files: (optional) Dictionary of ``'filename': file-like-objects``
| for multipart encoding upload.
| :param auth: (optional) Auth tuple or callable to enable
| Basic/Digest/Custom HTTP Auth.
| :param timeout: (optional) How many seconds to wait for the server to send
| data before giving up, as a float, or a :ref:`(connect timeout,
| read timeout) <timeouts>` tuple.
| :type timeout: float or tuple
| :param allow_redirects: (optional) Set to True by default.
| :type allow_redirects: bool
| :param proxies: (optional) Dictionary mapping protocol or protocol and
| hostname to the URL of the proxy.
| :param hooks: (optional) Dictionary mapping hook name to one event or
| list of events, event must be callable.
| :param stream: (optional) whether to immediately download the response
| content. Defaults to ``False``.
| :param verify: (optional) Either a boolean, in which case it controls whether we verify
| the server's TLS certificate, or a string, in which case it must be a path
| to a CA bundle to use. Defaults to ``True``. When set to
| ``False``, requests will accept any TLS certificate presented by
| the server, and will ignore hostname mismatches and/or expired
| certificates, which will make your application vulnerable to
| man-in-the-middle (MitM) attacks. Setting verify to ``False``
| may be useful during local development or testing.
| :param cert: (optional) if String, path to ssl client cert file (.pem).
| If Tuple, ('cert', 'key') pair.
| :rtype: requests.Response
|
| send(self, request: 'PreparedRequest', **kwargs: 'Any') -> 'Response'
| Send a given PreparedRequest.
|
| :rtype: requests.Response
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'__attrs__': 'list[str]', 'adapters': 'MutableMappi...
|
| __attrs__ = ['headers', 'cookies', 'auth', 'proxies', 'hooks', 'params...
|
| ----------------------------------------------------------------------
| Methods inherited from SessionRedirectMixin:
|
| get_redirect_target(self, resp: 'Response') -> 'str | None'
| Receives a Response. Returns a redirect URI or ``None``
|
| rebuild_auth(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to strip authentication from the
| request to avoid leaking credentials. This method intelligently removes
| and reapplies authentication where possible to avoid credential loss.
|
| rebuild_method(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to change the method of the request
| based on certain specs or browser behavior.
|
| rebuild_proxies(self, prepared_request: 'PreparedRequest', proxies: 'dict[str, str] | None') -> 'dict[str, str]'
| This method re-evaluates the proxy configuration by considering the
| environment variables. If we are redirected to a URL covered by
| NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
| proxy keys for this URL (in case they were stripped by a previous
| redirect).
|
| This method also replaces the Proxy-Authorization header where
| necessary.
|
| :rtype: dict
|
| resolve_redirects(self, resp: 'Response', req: 'PreparedRequest', stream: 'bool' = False, timeout: '_t.TimeoutType' = None, verify: '_t.VerifyType' = True, cert: '_t.CertType' = None, proxies: 'dict[str, str] | None' = None, yield_requests: 'bool' = False, **adapter_kwargs: 'Any') -> 'Generator[Response, None, None]'
| Receives a Response. Returns a generator of Responses or Requests.
|
| should_strip_auth(self, old_url: 'str', new_url: 'str') -> 'bool'
| Decide whether Authorization header should be removed when redirecting
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SessionRedirectMixin:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class SessionRedirectMixin(builtins.object)
| Methods defined here:
|
| get_redirect_target(self, resp: 'Response') -> 'str | None'
| Receives a Response. Returns a redirect URI or ``None``
|
| rebuild_auth(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to strip authentication from the
| request to avoid leaking credentials. This method intelligently removes
| and reapplies authentication where possible to avoid credential loss.
|
| rebuild_method(self, prepared_request: 'PreparedRequest', response: 'Response') -> 'None'
| When being redirected we may want to change the method of the request
| based on certain specs or browser behavior.
|
| rebuild_proxies(self, prepared_request: 'PreparedRequest', proxies: 'dict[str, str] | None') -> 'dict[str, str]'
| This method re-evaluates the proxy configuration by considering the
| environment variables. If we are redirected to a URL covered by
| NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
| proxy keys for this URL (in case they were stripped by a previous
| redirect).
|
| This method also replaces the Proxy-Authorization header where
| necessary.
|
| :rtype: dict
|
| resolve_redirects(self, resp: 'Response', req: 'PreparedRequest', stream: 'bool' = False, timeout: '_t.TimeoutType' = None, verify: '_t.VerifyType' = True, cert: '_t.CertType' = None, proxies: 'dict[str, str] | None' = None, yield_requests: 'bool' = False, **adapter_kwargs: 'Any') -> 'Generator[Response, None, None]'
| Receives a Response. Returns a generator of Responses or Requests.
|
| send(self, request: 'PreparedRequest', **kwargs: 'Any') -> 'Response'
|
| should_strip_auth(self, old_url: 'str', new_url: 'str') -> 'bool'
| Decide whether Authorization header should be removed when redirecting
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'cookies': 'RequestsCookieJar', 'max_redirects': 'i...
FUNCTIONS
merge_hooks(request_hooks: '_t.HooksType', session_hooks: '_t.HooksType', dict_class: 'type' = <class 'collections.OrderedDict'>) -> '_t.HooksType'
Properly merges both requests and session hooks.
This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
merge_setting(request_setting: 'Any', session_setting: 'Any', dict_class: 'type' = <class 'collections.OrderedDict'>) -> 'Any'
Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
preferred_clock = perf_counter(...)
perf_counter() -> float
Performance counter for benchmarking.
session() -> 'Session'
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be removed at a future date.
:rtype: Session
DATA
DEFAULT_PORTS = {'http': 80, 'https': 443}
DEFAULT_REDIRECT_LIMIT = 30
REDIRECT_STATI = (301, 302, 303, 307, 308)
TYPE_CHECKING = False
codes = <lookup 'status_codes'>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\sessions.py
requests.ssl
Python Library Documentation: module ssl
NAME
ssl - This module provides some more Pythonic support for SSL.
MODULE REFERENCE
https://docs.python.org/3.12/library/ssl.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
DESCRIPTION
Object types:
SSLSocket -- subtype of socket.socket which does SSL over the socket
Exceptions:
SSLError -- exception raised for I/O errors
Functions:
cert_time_to_seconds -- convert time string used for certificate
notBefore and notAfter functions to integer
seconds past the Epoch (the time values
returned from time.time())
get_server_certificate (addr, ssl_version, ca_certs, timeout) -- Retrieve the
certificate from the server at the specified
address and return it as a PEM-encoded string
Integer constants:
SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT
SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE
The following group define certificate requirements that one side is
allowing/requiring from the other side:
CERT_NONE - no certificates from the other side are required (or will
be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
validated, and if validation fails, the connection will
also fail
CERT_REQUIRED - certificates are required, and will be validated, and
if validation fails, the connection will also fail
The following constants identify various SSL protocol variants:
PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLS_CLIENT
PROTOCOL_TLS_SERVER
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2
The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6
ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
CLASSES
_ssl._SSLContext(builtins.object)
SSLContext
builtins.OSError(builtins.Exception)
SSLError
SSLCertVerificationError(SSLError, builtins.ValueError)
SSLEOFError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
builtins.object
SSLObject
builtins.tuple(builtins.object)
DefaultVerifyPaths
enum.Enum(builtins.object)
Purpose(_ASN1Object, enum.Enum)
enum.IntEnum(builtins.int, enum.ReprEnum)
AlertDescription
SSLErrorNumber
TLSVersion
VerifyMode
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
Options
VerifyFlags
socket.socket(_socket.socket)
SSLSocket
_ASN1Object(_ASN1Object)
Purpose(_ASN1Object, enum.Enum)
class AlertDescription(enum.IntEnum)
| AlertDescription(*values)
|
| An enumeration.
|
| Method resolution order:
| AlertDescription
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ALERT_DESCRIPTION_ACCESS_DENIED = <AlertDescription.ALERT_DESCRIPTION_...
|
| ALERT_DESCRIPTION_BAD_CERTIFICATE = <AlertDescription.ALERT_DESCRIPTIO...
|
| ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = <AlertDescription.ALERT...
|
| ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = <AlertDescription....
|
| ALERT_DESCRIPTION_BAD_RECORD_MAC = <AlertDescription.ALERT_DESCRIPTION...
|
| ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = <AlertDescription.ALERT_DESCRI...
|
| ALERT_DESCRIPTION_CERTIFICATE_REVOKED = <AlertDescription.ALERT_DESCRI...
|
| ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = <AlertDescription.ALERT_DESCRI...
|
| ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = <AlertDescription.ALERT_D...
|
| ALERT_DESCRIPTION_CLOSE_NOTIFY = <AlertDescription.ALERT_DESCRIPTION_C...
|
| ALERT_DESCRIPTION_DECODE_ERROR = <AlertDescription.ALERT_DESCRIPTION_D...
|
| ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = <AlertDescription.ALERT_DESC...
|
| ALERT_DESCRIPTION_DECRYPT_ERROR = <AlertDescription.ALERT_DESCRIPTION_...
|
| ALERT_DESCRIPTION_HANDSHAKE_FAILURE = <AlertDescription.ALERT_DESCRIPT...
|
| ALERT_DESCRIPTION_ILLEGAL_PARAMETER = <AlertDescription.ALERT_DESCRIPT...
|
| ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = <AlertDescription.ALERT_DESC...
|
| ALERT_DESCRIPTION_INTERNAL_ERROR = <AlertDescription.ALERT_DESCRIPTION...
|
| ALERT_DESCRIPTION_NO_RENEGOTIATION = <AlertDescription.ALERT_DESCRIPTI...
|
| ALERT_DESCRIPTION_PROTOCOL_VERSION = <AlertDescription.ALERT_DESCRIPTI...
|
| ALERT_DESCRIPTION_RECORD_OVERFLOW = <AlertDescription.ALERT_DESCRIPTIO...
|
| ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = <AlertDescription.ALERT_DESCRIP...
|
| ALERT_DESCRIPTION_UNKNOWN_CA = <AlertDescription.ALERT_DESCRIPTION_UNK...
|
| ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = <AlertDescription.ALERT_DESCR...
|
| ALERT_DESCRIPTION_UNRECOGNIZED_NAME = <AlertDescription.ALERT_DESCRIPT...
|
| ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = <AlertDescription.ALERT_DE...
|
| ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = <AlertDescription.ALERT_DESC...
|
| ALERT_DESCRIPTION_USER_CANCELLED = <AlertDescription.ALERT_DESCRIPTION...
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
CertificateError = class SSLCertVerificationError(SSLError, builtins.ValueError)
| A certificate could not be verified.
|
| Method resolution order:
| SSLCertVerificationError
| SSLError
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class DefaultVerifyPaths(builtins.tuple)
| DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath)
|
| DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath)
|
| Method resolution order:
| DefaultVerifyPaths
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.DefaultVerifyPaths
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.DefaultVerifyPaths
| Return a nicely formatted representation string
|
| _asdict(self) from collections.DefaultVerifyPaths
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.DefaultVerifyPaths
| Return a new DefaultVerifyPaths object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.DefaultVerifyPaths
| Make a new DefaultVerifyPaths object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath) from namedtuple_DefaultVerifyPaths.DefaultVerifyPaths
| Create new instance of DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| cafile
| Alias for field number 0
|
| capath
| Alias for field number 1
|
| openssl_cafile_env
| Alias for field number 2
|
| openssl_cafile
| Alias for field number 3
|
| openssl_capath_env
| Alias for field number 4
|
| openssl_capath
| Alias for field number 5
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('cafile', 'capath', 'openssl_cafile_env', 'openssl_c...
|
| _field_defaults = {}
|
| _fields = ('cafile', 'capath', 'openssl_cafile_env', 'openssl_cafile',...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
class Options(enum.IntFlag)
| Options(*values)
|
| An enumeration.
|
| Method resolution order:
| Options
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| OP_CIPHER_SERVER_PREFERENCE = <Options.OP_CIPHER_SERVER_PREFERENCE: 41...
|
| OP_ENABLE_KTLS = <Options.OP_ENABLE_KTLS: 8>
|
| OP_ENABLE_MIDDLEBOX_COMPAT = <Options.OP_ENABLE_MIDDLEBOX_COMPAT: 1048...
|
| OP_IGNORE_UNEXPECTED_EOF = <Options.OP_IGNORE_UNEXPECTED_EOF: 128>
|
| OP_LEGACY_SERVER_CONNECT = <Options.OP_LEGACY_SERVER_CONNECT: 4>
|
| OP_NO_COMPRESSION = <Options.OP_NO_COMPRESSION: 131072>
|
| OP_NO_RENEGOTIATION = <Options.OP_NO_RENEGOTIATION: 1073741824>
|
| OP_NO_SSLv3 = <Options.OP_NO_SSLv3: 33554432>
|
| OP_NO_TICKET = <Options.OP_NO_TICKET: 16384>
|
| OP_NO_TLSv1 = <Options.OP_NO_TLSv1: 67108864>
|
| OP_NO_TLSv1_1 = <Options.OP_NO_TLSv1_1: 268435456>
|
| OP_NO_TLSv1_2 = <Options.OP_NO_TLSv1_2: 134217728>
|
| OP_NO_TLSv1_3 = <Options.OP_NO_TLSv1_3: 536870912>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class Purpose(_ASN1Object, enum.Enum)
| Purpose(*values)
|
| SSLContext purpose flags with X509v3 Extended Key Usage objects
|
| Method resolution order:
| Purpose
| _ASN1Object
| _ASN1Object
| builtins.tuple
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CLIENT_AUTH = <Purpose.CLIENT_AUTH: _ASN1Object(nid=130, short...Clien...
|
| SERVER_AUTH = <Purpose.SERVER_AUTH: _ASN1Object(nid=129, short...Serve...
|
| ----------------------------------------------------------------------
| Class methods inherited from _ASN1Object:
|
| fromname(name)
| Create _ASN1Object from short name, long name or OID
|
| fromnid(nid)
| Create _ASN1Object from OpenSSL numeric ID
|
| ----------------------------------------------------------------------
| Methods inherited from _ASN1Object:
|
| __getnewargs__(self) from collections._ASN1Object
| Return self as a plain tuple. Used by copy and pickle.
|
| _asdict(self) from collections._ASN1Object
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections._ASN1Object
| Return a new _ASN1Object object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from _ASN1Object:
|
| _make(iterable) from collections._ASN1Object
| Make a new _ASN1Object object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _ASN1Object:
|
| nid
| Alias for field number 0
|
| shortname
| Alias for field number 1
|
| longname
| Alias for field number 2
|
| oid
| Alias for field number 3
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _ASN1Object:
|
| __match_args__ = ('nid', 'shortname', 'longname', 'oid')
|
| _field_defaults = {}
|
| _fields = ('nid', 'shortname', 'longname', 'oid')
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __format__(self, format_spec)
| Default object formatter.
|
| Return str(self) if format_spec is empty. Raise TypeError otherwise.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class SSLCertVerificationError(SSLError, builtins.ValueError)
| A certificate could not be verified.
|
| Method resolution order:
| SSLCertVerificationError
| SSLError
| builtins.OSError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLContext(_ssl._SSLContext)
| SSLContext(protocol=None, *args, **kwargs)
|
| An SSLContext holds various SSL-related configuration options and
| data, such as certificates and possibly a private key.
|
| Method resolution order:
| SSLContext
| _ssl._SSLContext
| builtins.object
|
| Methods defined here:
|
| load_default_certs(self, purpose=<Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>)
|
| set_alpn_protocols(self, alpn_protocols)
|
| set_npn_protocols(self, npn_protocols)
|
| set_servername_callback(self, server_name_callback)
|
| wrap_bio(self, incoming, outgoing, server_side=False, server_hostname=None, session=None)
|
| wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None, session=None)
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(cls, protocol=None, *args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| protocol
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| hostname_checks_common_name
|
| maximum_version
|
| minimum_version
|
| options
|
| verify_flags
|
| verify_mode
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| sslobject_class = <class 'ssl.SSLObject'>
| This class implements an interface on top of a low-level SSL object as
| implemented by OpenSSL. This object captures the state of an SSL connection
| but does not provide any network IO itself. IO needs to be performed
| through separate "BIO" objects which are OpenSSL's IO abstraction layer.
|
| This class does not have a public constructor. Instances are returned by
| ``SSLContext.wrap_bio``. This class is typically used by framework authors
| that want to implement asynchronous IO for SSL through memory buffers.
|
| When compared to ``SSLSocket``, this object lacks the following features:
|
| * Any form of network IO, including methods such as ``recv`` and ``send``.
| * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
|
|
| sslsocket_class = <class 'ssl.SSLSocket'>
| This class implements a subtype of socket.socket that wraps
| the underlying OS socket in an SSL context when necessary, and
| provides read and write methods over that channel.
|
|
| ----------------------------------------------------------------------
| Methods inherited from _ssl._SSLContext:
|
| cert_store_stats(self, /)
| Returns quantities of loaded X.509 certificates.
|
| X.509 certificates with a CA extension and certificate revocation lists
| inside the context's cert store.
|
| NOTE: Certificates in a capath directory aren't loaded unless they have
| been used at least once.
|
| get_ca_certs(self, /, binary_form=False)
| Returns a list of dicts with information of loaded CA certs.
|
| If the optional argument is True, returns a DER-encoded copy of the CA
| certificate.
|
| NOTE: Certificates in a capath directory aren't loaded unless they have
| been used at least once.
|
| get_ciphers(self, /)
|
| load_cert_chain(self, /, certfile, keyfile=None, password=None)
|
| load_dh_params(self, path, /)
|
| load_verify_locations(self, /, cafile=None, capath=None, cadata=None)
|
| session_stats(self, /)
|
| set_ciphers(self, cipherlist, /)
|
| set_default_verify_paths(self, /)
|
| set_ecdh_curve(self, name, /)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _ssl._SSLContext:
|
| check_hostname
|
| keylog_filename
|
| num_tickets
| Control the number of TLSv1.3 session tickets
|
| post_handshake_auth
|
| security_level
| The current security level
|
| sni_callback
| Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.
|
| If the argument is None then the callback is disabled. The method is called
| with the SSLSocket, the server name as a string, and the SSLContext object.
| See RFC 6066 for details of the SNI extension.
class SSLEOFError(SSLError)
| SSL/TLS connection terminated abruptly.
|
| Method resolution order:
| SSLEOFError
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLError(builtins.OSError)
| An error occurred in the SSL implementation.
|
| Method resolution order:
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLErrorNumber(enum.IntEnum)
| SSLErrorNumber(*values)
|
| An enumeration.
|
| Method resolution order:
| SSLErrorNumber
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| SSL_ERROR_EOF = <SSLErrorNumber.SSL_ERROR_EOF: 8>
|
| SSL_ERROR_INVALID_ERROR_CODE = <SSLErrorNumber.SSL_ERROR_INVALID_ERROR...
|
| SSL_ERROR_SSL = <SSLErrorNumber.SSL_ERROR_SSL: 1>
|
| SSL_ERROR_SYSCALL = <SSLErrorNumber.SSL_ERROR_SYSCALL: 5>
|
| SSL_ERROR_WANT_CONNECT = <SSLErrorNumber.SSL_ERROR_WANT_CONNECT: 7>
|
| SSL_ERROR_WANT_READ = <SSLErrorNumber.SSL_ERROR_WANT_READ: 2>
|
| SSL_ERROR_WANT_WRITE = <SSLErrorNumber.SSL_ERROR_WANT_WRITE: 3>
|
| SSL_ERROR_WANT_X509_LOOKUP = <SSLErrorNumber.SSL_ERROR_WANT_X509_LOOKU...
|
| SSL_ERROR_ZERO_RETURN = <SSLErrorNumber.SSL_ERROR_ZERO_RETURN: 6>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class SSLObject(builtins.object)
| SSLObject(*args, **kwargs)
|
| This class implements an interface on top of a low-level SSL object as
| implemented by OpenSSL. This object captures the state of an SSL connection
| but does not provide any network IO itself. IO needs to be performed
| through separate "BIO" objects which are OpenSSL's IO abstraction layer.
|
| This class does not have a public constructor. Instances are returned by
| ``SSLContext.wrap_bio``. This class is typically used by framework authors
| that want to implement asynchronous IO for SSL through memory buffers.
|
| When compared to ``SSLSocket``, this object lacks the following features:
|
| * Any form of network IO, including methods such as ``recv`` and ``send``.
| * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery.
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| cipher(self)
| Return the currently selected cipher as a 3-tuple ``(name,
| ssl_version, secret_bits)``.
|
| compression(self)
| Return the current compression algorithm in use, or ``None`` if
| compression was not negotiated or not supported by one of the peers.
|
| do_handshake(self)
| Start the SSL/TLS handshake.
|
| get_channel_binding(self, cb_type='tls-unique')
| Get channel binding data for current connection. Raise ValueError
| if the requested `cb_type` is not supported. Return bytes of the data
| or None if the data is not available (e.g. before the handshake).
|
| getpeercert(self, binary_form=False)
| Returns a formatted version of the data in the certificate provided
| by the other end of the SSL channel.
|
| Return None if no certificate was provided, {} if a certificate was
| provided, but not validated.
|
| pending(self)
| Return the number of bytes that can be read immediately.
|
| read(self, len=1024, buffer=None)
| Read up to 'len' bytes from the SSL object and return them.
|
| If 'buffer' is provided, read into this buffer and return the number of
| bytes read.
|
| selected_alpn_protocol(self)
| Return the currently selected ALPN protocol as a string, or ``None``
| if a next protocol was not negotiated or if ALPN is not supported by one
| of the peers.
|
| selected_npn_protocol(self)
| Return the currently selected NPN protocol as a string, or ``None``
| if a next protocol was not negotiated or if NPN is not supported by one
| of the peers.
|
| shared_ciphers(self)
| Return a list of ciphers shared by the client during the handshake or
| None if this is not a valid server connection.
|
| unwrap(self)
| Start the SSL shutdown handshake.
|
| verify_client_post_handshake(self)
|
| version(self)
| Return a string identifying the protocol version used by the
| current SSL channel.
|
| write(self, data)
| Write 'data' to the SSL object and return the number of bytes
| written.
|
| The 'data' argument must support the buffer interface.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| server_hostname
| The currently set server hostname (for SNI), or ``None`` if no
| server hostname is set.
|
| server_side
| Whether this is a server-side socket.
|
| session_reused
| Was the client session reused during handshake
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| context
| The SSLContext that is currently in use.
|
| session
| The SSLSession for client socket.
class SSLSocket(socket.socket)
| SSLSocket(*args, **kwargs)
|
| This class implements a subtype of socket.socket that wraps
| the underlying OS socket in an SSL context when necessary, and
| provides read and write methods over that channel.
|
| Method resolution order:
| SSLSocket
| socket.socket
| _socket.socket
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| accept(self)
| Accepts a new connection from a remote client, and returns
| a tuple containing that new connection wrapped with a server-side
| SSL channel, and the address of the remote client.
|
| cipher(self)
| Return the currently selected cipher as a 3-tuple ``(name,
| ssl_version, secret_bits)``.
|
| compression(self)
| Return the current compression algorithm in use, or ``None`` if
| compression was not negotiated or not supported by one of the peers.
|
| connect(self, addr)
| Connects to remote ADDR, and then wraps the connection in
| an SSL channel.
|
| connect_ex(self, addr)
| Connects to remote ADDR, and then wraps the connection in
| an SSL channel.
|
| do_handshake(self, block=False)
| Start the SSL/TLS handshake.
|
| dup(self)
| dup() -> socket object
|
| Duplicate the socket. Return a new socket object connected to the same
| system resource. The new socket is non-inheritable.
|
| get_channel_binding(self, cb_type='tls-unique')
| Get channel binding data for current connection. Raise ValueError
| if the requested `cb_type` is not supported. Return bytes of the data
| or None if the data is not available (e.g. before the handshake).
|
| getpeercert(self, binary_form=False)
| Returns a formatted version of the data in the certificate provided
| by the other end of the SSL channel.
|
| Return None if no certificate was provided, {} if a certificate was
| provided, but not validated.
|
| pending(self)
| Return the number of bytes that can be read immediately.
|
| read(self, len=1024, buffer=None)
| Read up to LEN bytes and return them.
| Return zero-length string on EOF.
|
| recv(self, buflen=1024, flags=0)
| recv(buffersize[, flags]) -> data
|
| Receive up to buffersize bytes from the socket. For the optional flags
| argument, see the Unix manual. When no data is available, block until
| at least one byte is available or until the remote end is closed. When
| the remote end is closed and all data is read, return the empty string.
|
| recv_into(self, buffer, nbytes=None, flags=0)
| recv_into(buffer, [nbytes[, flags]]) -> nbytes_read
|
| A version of recv() that stores its data into a buffer rather than creating
| a new string. Receive up to buffersize bytes from the socket. If buffersize
| is not specified (or 0), receive up to the size available in the given buffer.
|
| See recv() for documentation about the flags.
|
| recvfrom(self, buflen=1024, flags=0)
| recvfrom(buffersize[, flags]) -> (data, address info)
|
| Like recv(buffersize, flags) but also return the sender's address info.
|
| recvfrom_into(self, buffer, nbytes=None, flags=0)
| recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
|
| Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
|
| recvmsg(self, *args, **kwargs)
|
| recvmsg_into(self, *args, **kwargs)
|
| selected_alpn_protocol(self)
| Return the currently selected ALPN protocol as a string, or ``None``
| if a next protocol was not negotiated or if ALPN is not supported by one
| of the peers.
|
| selected_npn_protocol(self)
| Return the currently selected NPN protocol as a string, or ``None``
| if a next protocol was not negotiated or if NPN is not supported by one
| of the peers.
|
| send(self, data, flags=0)
| send(data[, flags]) -> count
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. Return the number of bytes
| sent; this may be less than len(data) if the network is busy.
|
| sendall(self, data, flags=0)
| sendall(data[, flags])
|
| Send a data string to the socket. For the optional flags
| argument, see the Unix manual. This calls send() repeatedly
| until all data is sent. If an error occurs, it's impossible
| to tell how much data has been sent.
|
| sendfile(self, file, offset=0, count=None)
| Send a file, possibly by using os.sendfile() if this is a
| clear-text socket. Return the total number of bytes sent.
|
| sendmsg(self, *args, **kwargs)
|
| sendto(self, data, flags_or_addr, addr=None)
| sendto(data[, flags], address) -> count
|
| Like send(data, flags) but allows specifying the destination address.
| For IP sockets, the address is a pair (hostaddr, port).
|
| shared_ciphers(self)
| Return a list of ciphers shared by the client during the handshake or
| None if this is not a valid server connection.
|
| shutdown(self, how)
| shutdown(flag)
|
| Shut down the reading side of the socket (flag == SHUT_RD), the writing side
| of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
|
| unwrap(self)
| Start the SSL shutdown handshake.
|
| verify_client_post_handshake(self)
|
| version(self)
| Return a string identifying the protocol version used by the
| current SSL channel.
|
| write(self, data)
| Write DATA to the underlying SSL channel. Returns
| number of bytes of DATA actually transmitted.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| session_reused
| Was the client session reused during handshake
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| context
| The SSLContext that is currently in use.
|
| session
| The SSLSession for client socket.
|
| ----------------------------------------------------------------------
| Methods inherited from socket.socket:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __getstate__(self)
| Helper for pickle.
|
| __repr__(self)
| Wrap __repr__() to reveal the real class name and socket
| address(es).
|
| close(self)
| close()
|
| Close the socket. It cannot be used after this call.
|
| detach(self)
| detach() -> file descriptor
|
| Close the socket object without closing the underlying file descriptor.
| The object cannot be used after this call, but the file descriptor
| can be reused for other purposes. The file descriptor is returned.
|
| get_inheritable(self)
| Get the inheritable flag of the socket
|
| makefile(self, mode='r', buffering=None, *, encoding=None, errors=None, newline=None)
| makefile(...) -> an I/O stream connected to the socket
|
| The arguments are as for io.open() after the filename, except the only
| supported mode values are 'r' (default), 'w', 'b', or a combination of
| those.
|
| set_inheritable(self, inheritable)
| Set the inheritable flag of the socket
|
| ----------------------------------------------------------------------
| Readonly properties inherited from socket.socket:
|
| family
| Read-only access to the address family for this socket.
|
| type
| Read-only access to the socket type.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from socket.socket:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from _socket.socket:
|
| __del__(...)
|
| bind(...)
| bind(address)
|
| Bind the socket to a local address. For IP sockets, the address is a
| pair (host, port); the host must refer to the local host. For raw packet
| sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]])
|
| fileno(...)
| fileno() -> integer
|
| Return the integer file descriptor of the socket.
|
| getblocking(...)
| getblocking()
|
| Returns True if socket is in blocking mode, or False if it
| is in non-blocking mode.
|
| getpeername(...)
| getpeername() -> address info
|
| Return the address of the remote endpoint. For IP sockets, the address
| info is a pair (hostaddr, port).
|
| getsockname(...)
| getsockname() -> address info
|
| Return the address of the local endpoint. The format depends on the
| address family. For IPv4 sockets, the address info is a pair
| (hostaddr, port). For IPv6 sockets, the address info is a 4-tuple
| (hostaddr, port, flowinfo, scope_id).
|
| getsockopt(...)
| getsockopt(level, option[, buffersize]) -> value
|
| Get a socket option. See the Unix manual for level and option.
| If a nonzero buffersize argument is given, the return value is a
| string of that length; otherwise it is an integer.
|
| gettimeout(...)
| gettimeout() -> timeout
|
| Returns the timeout in seconds (float) associated with socket
| operations. A timeout of None indicates that timeouts on socket
| operations are disabled.
|
| ioctl(...)
| ioctl(cmd, option) -> long
|
| Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are
| SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.
| SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).
| SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default
|
| listen(...)
| listen([backlog])
|
| Enable a server to accept connections. If backlog is specified, it must be
| at least 0 (if it is lower, it is set to 0); it specifies the number of
| unaccepted connections that the system will allow before refusing new
| connections. If not specified, a default reasonable value is chosen.
|
| setblocking(...)
| setblocking(flag)
|
| Set the socket to blocking (flag is true) or non-blocking (false).
| setblocking(True) is equivalent to settimeout(None);
| setblocking(False) is equivalent to settimeout(0.0).
|
| setsockopt(...)
| setsockopt(level, option, value: int)
| setsockopt(level, option, value: buffer)
| setsockopt(level, option, None, optlen: int)
|
| Set a socket option. See the Unix manual for level and option.
| The value argument can either be an integer, a string buffer, or
| None, optlen.
|
| settimeout(...)
| settimeout(timeout)
|
| Set a timeout on socket operations. 'timeout' can be a float,
| giving in seconds, or None. Setting a timeout of None disables
| the timeout feature and is equivalent to setblocking(1).
| Setting a timeout of zero is the same as setblocking(0).
|
| share(...)
| share(process_id) -> bytes
|
| Share the socket with another process. The target process id
| must be provided and the resulting bytes object passed to the target
| process. There the shared socket can be instantiated by calling
| socket.fromshare().
|
| ----------------------------------------------------------------------
| Static methods inherited from _socket.socket:
|
| __new__(*args, **kwargs) class method of _socket.socket
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _socket.socket:
|
| proto
| the socket protocol
|
| timeout
| the socket timeout
class SSLSyscallError(SSLError)
| System error when attempting SSL operation.
|
| Method resolution order:
| SSLSyscallError
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLWantReadError(SSLError)
| Non-blocking SSL socket needs to read more data
| before the requested operation can be completed.
|
| Method resolution order:
| SSLWantReadError
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLWantWriteError(SSLError)
| Non-blocking SSL socket needs to write more data
| before the requested operation can be completed.
|
| Method resolution order:
| SSLWantWriteError
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SSLZeroReturnError(SSLError)
| SSL/TLS session closed cleanly.
|
| Method resolution order:
| SSLZeroReturnError
| SSLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from SSLError:
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.OSError:
|
| __new__(*args, **kwargs) class method of builtins.OSError
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class TLSVersion(enum.IntEnum)
| TLSVersion(*values)
|
| An enumeration.
|
| Method resolution order:
| TLSVersion
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MAXIMUM_SUPPORTED = <TLSVersion.MAXIMUM_SUPPORTED: -1>
|
| MINIMUM_SUPPORTED = <TLSVersion.MINIMUM_SUPPORTED: -2>
|
| SSLv3 = <TLSVersion.SSLv3: 768>
|
| TLSv1 = <TLSVersion.TLSv1: 769>
|
| TLSv1_1 = <TLSVersion.TLSv1_1: 770>
|
| TLSv1_2 = <TLSVersion.TLSv1_2: 771>
|
| TLSv1_3 = <TLSVersion.TLSv1_3: 772>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class VerifyFlags(enum.IntFlag)
| VerifyFlags(*values)
|
| An enumeration.
|
| Method resolution order:
| VerifyFlags
| enum.IntFlag
| builtins.int
| enum.ReprEnum
| enum.Flag
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __and__(self, other) from enum.Flag
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __invert__(self) from enum.Flag
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __or__(self, other) from enum.Flag
| Return self|value.
|
| __rand__ = __and__(self, other)
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| VERIFY_ALLOW_PROXY_CERTS = <VerifyFlags.VERIFY_ALLOW_PROXY_CERTS: 64>
|
| VERIFY_CRL_CHECK_LEAF = <VerifyFlags.VERIFY_CRL_CHECK_LEAF: 4>
|
| VERIFY_X509_PARTIAL_CHAIN = <VerifyFlags.VERIFY_X509_PARTIAL_CHAIN: 52...
|
| VERIFY_X509_STRICT = <VerifyFlags.VERIFY_X509_STRICT: 32>
|
| VERIFY_X509_TRUSTED_FIRST = <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32...
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntFlag:
|
| __repr__(self) from enum.Flag
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Flag:
|
| __contains__(self, other)
| Returns True if self has at least the same flags set as other.
|
| __iter__(self)
| Returns flags in definition order.
|
| __len__(self)
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __getitem__(name)
| Return the member matching `name`.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
class VerifyMode(enum.IntEnum)
| VerifyMode(*values)
|
| An enumeration.
|
| Method resolution order:
| VerifyMode
| enum.IntEnum
| builtins.int
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.int
| Convert to a string according to format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CERT_NONE = <VerifyMode.CERT_NONE: 0>
|
| CERT_OPTIONAL = <VerifyMode.CERT_OPTIONAL: 1>
|
| CERT_REQUIRED = <VerifyMode.CERT_REQUIRED: 2>
|
| ----------------------------------------------------------------------
| Methods inherited from enum.IntEnum:
|
| __repr__(self) from enum.Enum
| Return repr(self).
|
| __str__ = __repr__(self, /) from builtins.int
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.int:
|
| __abs__(self, /)
| abs(self)
|
| __add__(self, value, /)
| Return self+value.
|
| __and__(self, value, /)
| Return self&value.
|
| __bool__(self, /)
| True if self else False
|
| __ceil__(...)
| Ceiling of an Integral returns itself.
|
| __divmod__(self, value, /)
| Return divmod(self, value).
|
| __eq__(self, value, /)
| Return self==value.
|
| __float__(self, /)
| float(self)
|
| __floor__(...)
| Flooring an Integral returns itself.
|
| __floordiv__(self, value, /)
| Return self//value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getnewargs__(self, /)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __index__(self, /)
| Return self converted to an integer, if self is suitable for use as an index into a list.
|
| __int__(self, /)
| int(self)
|
| __invert__(self, /)
| ~self
|
| __le__(self, value, /)
| Return self<=value.
|
| __lshift__(self, value, /)
| Return self<<value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __neg__(self, /)
| -self
|
| __or__(self, value, /)
| Return self|value.
|
| __pos__(self, /)
| +self
|
| __pow__(self, value, mod=None, /)
| Return pow(self, value, mod).
|
| __radd__(self, value, /)
| Return value+self.
|
| __rand__(self, value, /)
| Return value&self.
|
| __rdivmod__(self, value, /)
| Return divmod(value, self).
|
| __rfloordiv__(self, value, /)
| Return value//self.
|
| __rlshift__(self, value, /)
| Return value<<self.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __ror__(self, value, /)
| Return value|self.
|
| __round__(...)
| Rounding an Integral returns itself.
|
| Rounding with an ndigits argument also returns an integer.
|
| __rpow__(self, value, mod=None, /)
| Return pow(value, self, mod).
|
| __rrshift__(self, value, /)
| Return value>>self.
|
| __rshift__(self, value, /)
| Return self>>value.
|
| __rsub__(self, value, /)
| Return value-self.
|
| __rtruediv__(self, value, /)
| Return value/self.
|
| __rxor__(self, value, /)
| Return value^self.
|
| __sizeof__(self, /)
| Returns size in memory, in bytes.
|
| __sub__(self, value, /)
| Return self-value.
|
| __truediv__(self, value, /)
| Return self/value.
|
| __trunc__(...)
| Truncating an Integral returns itself.
|
| __xor__(self, value, /)
| Return self^value.
|
| as_integer_ratio(self, /)
| Return a pair of integers, whose ratio is equal to the original int.
|
| The ratio is in lowest terms and has a positive denominator.
|
| >>> (10).as_integer_ratio()
| (10, 1)
| >>> (-10).as_integer_ratio()
| (-10, 1)
| >>> (0).as_integer_ratio()
| (0, 1)
|
| bit_count(self, /)
| Number of ones in the binary representation of the absolute value of self.
|
| Also known as the population count.
|
| >>> bin(13)
| '0b1101'
| >>> (13).bit_count()
| 3
|
| bit_length(self, /)
| Number of bits necessary to represent self in binary.
|
| >>> bin(37)
| '0b100101'
| >>> (37).bit_length()
| 6
|
| conjugate(...)
| Returns self, the complex conjugate of any int.
|
| is_integer(self, /)
| Returns True. Exists for duck type compatibility with float.is_integer.
|
| to_bytes(self, /, length=1, byteorder='big', *, signed=False)
| Return an array of bytes representing an integer.
|
| length
| Length of bytes object to use. An OverflowError is raised if the
| integer is not representable with the given number of bytes. Default
| is length 1.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Determines whether two's complement is used to represent the integer.
| If signed is False and a negative integer is given, an OverflowError
| is raised.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.int:
|
| from_bytes(bytes, byteorder='big', *, signed=False)
| Return the integer represented by the given array of bytes.
|
| bytes
| Holds the array of bytes to convert. The argument must either
| support the buffer protocol or be an iterable object producing bytes.
| Bytes and bytearray are examples of built-in objects that support the
| buffer protocol.
| byteorder
| The byte order used to represent the integer. If byteorder is 'big',
| the most significant byte is at the beginning of the byte array. If
| byteorder is 'little', the most significant byte is at the end of the
| byte array. To request the native byte order of the host system, use
| `sys.byteorder' as the byte order value. Default is to use 'big'.
| signed
| Indicates whether two's complement is used to represent the integer.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.int:
|
| denominator
| the denominator of a rational number in lowest terms
|
| imag
| the imaginary part of a complex number
|
| numerator
| the numerator of a rational number in lowest terms
|
| real
| the real part of a complex number
|
| ----------------------------------------------------------------------
| Methods inherited from enum.Enum:
|
| __dir__(self)
| Returns public methods and other interesting attributes.
|
| __init__(self, *args, **kwds)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce_ex__(self, proto)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
FUNCTIONS
DER_cert_to_PEM_cert(der_cert_bytes)
Takes a certificate in binary DER format and returns the
PEM version of it as a string.
PEM_cert_to_DER_cert(pem_cert_string)
Takes a certificate in ASCII PEM format and returns the
DER-encoded version of it as a byte sequence
RAND_add(string, entropy, /)
Mix string into the OpenSSL PRNG state.
entropy (a float) is a lower bound on the entropy contained in
string. See RFC 4086.
RAND_bytes(n, /)
Generate n cryptographically strong pseudo-random bytes.
RAND_status()
Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.
It is necessary to seed the PRNG with RAND_add() on some platforms before
using the ssl() function.
cert_time_to_seconds(cert_time)
Return the time in seconds since the Epoch, given the timestring
representing the "notBefore" or "notAfter" date from a certificate
in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).
"notBefore" or "notAfter" dates must use UTC (RFC 5280).
Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
UTC should be specified as GMT (see ASN1_TIME_print())
create_default_context(purpose=<Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>, *, cafile=None, capath=None, cadata=None)
Create a SSLContext object with default settings.
NOTE: The protocol and settings may change anytime without prior
deprecation. The values represent a fair balance between maximum
compatibility and security.
enum_certificates(store_name)
Retrieve certificates from Windows' cert store.
store_name may be one of 'CA', 'ROOT' or 'MY'. The system may provide
more cert storages, too. The function returns a list of (bytes,
encoding_type, trust) tuples. The encoding_type flag can be interpreted
with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either
a set of OIDs or the boolean True.
enum_crls(store_name)
Retrieve CRLs from Windows' cert store.
store_name may be one of 'CA', 'ROOT' or 'MY'. The system may provide
more cert storages, too. The function returns a list of (bytes,
encoding_type) tuples. The encoding_type flag can be interpreted with
X509_ASN_ENCODING or PKCS_7_ASN_ENCODING.
get_default_verify_paths()
Return paths to default cafile and capath.
get_protocol_name(protocol_code)
get_server_certificate(addr, ssl_version=<_SSLMethod.PROTOCOL_TLS_CLIENT: 16>, ca_certs=None, timeout=<object object at 0x00000235A7DB8A50>)
Retrieve the certificate from the server at the specified address,
and return it as a PEM-encoded string.
If 'ca_certs' is specified, validate the server cert against it.
If 'ssl_version' is specified, use it in the connection attempt.
If 'timeout' is specified, use it in the connection attempt.
DATA
ALERT_DESCRIPTION_ACCESS_DENIED = <AlertDescription.ALERT_DESCRIPTION_...
ALERT_DESCRIPTION_BAD_CERTIFICATE = <AlertDescription.ALERT_DESCRIPTIO...
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = <AlertDescription.ALERT...
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = <AlertDescription....
ALERT_DESCRIPTION_BAD_RECORD_MAC = <AlertDescription.ALERT_DESCRIPTION...
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = <AlertDescription.ALERT_DESCRI...
ALERT_DESCRIPTION_CERTIFICATE_REVOKED = <AlertDescription.ALERT_DESCRI...
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = <AlertDescription.ALERT_DESCRI...
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = <AlertDescription.ALERT_D...
ALERT_DESCRIPTION_CLOSE_NOTIFY = <AlertDescription.ALERT_DESCRIPTION_C...
ALERT_DESCRIPTION_DECODE_ERROR = <AlertDescription.ALERT_DESCRIPTION_D...
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = <AlertDescription.ALERT_DESC...
ALERT_DESCRIPTION_DECRYPT_ERROR = <AlertDescription.ALERT_DESCRIPTION_...
ALERT_DESCRIPTION_HANDSHAKE_FAILURE = <AlertDescription.ALERT_DESCRIPT...
ALERT_DESCRIPTION_ILLEGAL_PARAMETER = <AlertDescription.ALERT_DESCRIPT...
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = <AlertDescription.ALERT_DESC...
ALERT_DESCRIPTION_INTERNAL_ERROR = <AlertDescription.ALERT_DESCRIPTION...
ALERT_DESCRIPTION_NO_RENEGOTIATION = <AlertDescription.ALERT_DESCRIPTI...
ALERT_DESCRIPTION_PROTOCOL_VERSION = <AlertDescription.ALERT_DESCRIPTI...
ALERT_DESCRIPTION_RECORD_OVERFLOW = <AlertDescription.ALERT_DESCRIPTIO...
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = <AlertDescription.ALERT_DESCRIP...
ALERT_DESCRIPTION_UNKNOWN_CA = <AlertDescription.ALERT_DESCRIPTION_UNK...
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = <AlertDescription.ALERT_DESCR...
ALERT_DESCRIPTION_UNRECOGNIZED_NAME = <AlertDescription.ALERT_DESCRIPT...
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = <AlertDescription.ALERT_DE...
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = <AlertDescription.ALERT_DESC...
ALERT_DESCRIPTION_USER_CANCELLED = <AlertDescription.ALERT_DESCRIPTION...
CERT_NONE = <VerifyMode.CERT_NONE: 0>
CERT_OPTIONAL = <VerifyMode.CERT_OPTIONAL: 1>
CERT_REQUIRED = <VerifyMode.CERT_REQUIRED: 2>
CHANNEL_BINDING_TYPES = ['tls-unique']
HAS_ALPN = True
HAS_ECDH = True
HAS_NEVER_CHECK_COMMON_NAME = True
HAS_NPN = False
HAS_SNI = True
HAS_SSLv2 = False
HAS_SSLv3 = False
HAS_TLSv1 = True
HAS_TLSv1_1 = True
HAS_TLSv1_2 = True
HAS_TLSv1_3 = True
OPENSSL_VERSION = 'OpenSSL 3.0.15 3 Sep 2024'
OPENSSL_VERSION_INFO = (3, 0, 0, 15, 0)
OPENSSL_VERSION_NUMBER = 805306608
OP_ALL = <Options.OP_ALL: 2147483728>
OP_CIPHER_SERVER_PREFERENCE = <Options.OP_CIPHER_SERVER_PREFERENCE: 41...
OP_ENABLE_KTLS = <Options.OP_ENABLE_KTLS: 8>
OP_ENABLE_MIDDLEBOX_COMPAT = <Options.OP_ENABLE_MIDDLEBOX_COMPAT: 1048...
OP_IGNORE_UNEXPECTED_EOF = <Options.OP_IGNORE_UNEXPECTED_EOF: 128>
OP_LEGACY_SERVER_CONNECT = <Options.OP_LEGACY_SERVER_CONNECT: 4>
OP_NO_COMPRESSION = <Options.OP_NO_COMPRESSION: 131072>
OP_NO_RENEGOTIATION = <Options.OP_NO_RENEGOTIATION: 1073741824>
OP_NO_SSLv2 = <Options.OP_NO_SSLv2: 0>
OP_NO_SSLv3 = <Options.OP_NO_SSLv3: 33554432>
OP_NO_TICKET = <Options.OP_NO_TICKET: 16384>
OP_NO_TLSv1 = <Options.OP_NO_TLSv1: 67108864>
OP_NO_TLSv1_1 = <Options.OP_NO_TLSv1_1: 268435456>
OP_NO_TLSv1_2 = <Options.OP_NO_TLSv1_2: 134217728>
OP_NO_TLSv1_3 = <Options.OP_NO_TLSv1_3: 536870912>
OP_SINGLE_DH_USE = <Options.OP_NO_SSLv2: 0>
OP_SINGLE_ECDH_USE = <Options.OP_NO_SSLv2: 0>
PEM_FOOTER = '-----END CERTIFICATE-----'
PEM_HEADER = '-----BEGIN CERTIFICATE-----'
PROTOCOL_SSLv23 = <_SSLMethod.PROTOCOL_TLS: 2>
PROTOCOL_TLS = <_SSLMethod.PROTOCOL_TLS: 2>
PROTOCOL_TLS_CLIENT = <_SSLMethod.PROTOCOL_TLS_CLIENT: 16>
PROTOCOL_TLS_SERVER = <_SSLMethod.PROTOCOL_TLS_SERVER: 17>
PROTOCOL_TLSv1 = <_SSLMethod.PROTOCOL_TLSv1: 3>
PROTOCOL_TLSv1_1 = <_SSLMethod.PROTOCOL_TLSv1_1: 4>
PROTOCOL_TLSv1_2 = <_SSLMethod.PROTOCOL_TLSv1_2: 5>
SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
SOL_SOCKET = 65535
SO_TYPE = 4104
SSL_ERROR_EOF = <SSLErrorNumber.SSL_ERROR_EOF: 8>
SSL_ERROR_INVALID_ERROR_CODE = <SSLErrorNumber.SSL_ERROR_INVALID_ERROR...
SSL_ERROR_SSL = <SSLErrorNumber.SSL_ERROR_SSL: 1>
SSL_ERROR_SYSCALL = <SSLErrorNumber.SSL_ERROR_SYSCALL: 5>
SSL_ERROR_WANT_CONNECT = <SSLErrorNumber.SSL_ERROR_WANT_CONNECT: 7>
SSL_ERROR_WANT_READ = <SSLErrorNumber.SSL_ERROR_WANT_READ: 2>
SSL_ERROR_WANT_WRITE = <SSLErrorNumber.SSL_ERROR_WANT_WRITE: 3>
SSL_ERROR_WANT_X509_LOOKUP = <SSLErrorNumber.SSL_ERROR_WANT_X509_LOOKU...
SSL_ERROR_ZERO_RETURN = <SSLErrorNumber.SSL_ERROR_ZERO_RETURN: 6>
VERIFY_ALLOW_PROXY_CERTS = <VerifyFlags.VERIFY_ALLOW_PROXY_CERTS: 64>
VERIFY_CRL_CHECK_CHAIN = <VerifyFlags.VERIFY_CRL_CHECK_CHAIN: 12>
VERIFY_CRL_CHECK_LEAF = <VerifyFlags.VERIFY_CRL_CHECK_LEAF: 4>
VERIFY_DEFAULT = <VerifyFlags.VERIFY_DEFAULT: 0>
VERIFY_X509_PARTIAL_CHAIN = <VerifyFlags.VERIFY_X509_PARTIAL_CHAIN: 52...
VERIFY_X509_STRICT = <VerifyFlags.VERIFY_X509_STRICT: 32>
VERIFY_X509_TRUSTED_FIRST = <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\ssl.py
requests.status_codes
Python Library Documentation: module requests.status_codes in requests
NAME
requests.status_codes
DESCRIPTION
The ``codes`` object defines a mapping from common names for HTTP statuses
to their numerical codes, accessible either as attributes or as dictionary
items.
Example::
>>> import requests
>>> requests.codes['temporary_redirect']
307
>>> requests.codes.teapot
418
>>> requests.codes['\o/']
200
Some codes have multiple names, and both upper- and lower-case versions of
the names are allowed. For example, ``codes.ok``, ``codes.OK``, and
``codes.okay`` all correspond to the HTTP status code 200.
* 100: ``continue``
* 101: ``switching_protocols``
* 102: ``processing``, ``early-hints``
* 103: ``checkpoint``
* 122: ``uri_too_long``, ``request_uri_too_long``
* 200: ``ok``, ``okay``, ``all_ok``, ``all_okay``, ``all_good``, ``\o/``, ``✓``
* 201: ``created``
* 202: ``accepted``
* 203: ``non_authoritative_info``, ``non_authoritative_information``
* 204: ``no_content``
* 205: ``reset_content``, ``reset``
* 206: ``partial_content``, ``partial``
* 207: ``multi_status``, ``multiple_status``, ``multi_stati``, ``multiple_stati``
* 208: ``already_reported``
* 226: ``im_used``
* 300: ``multiple_choices``
* 301: ``moved_permanently``, ``moved``, ``\o-``
* 302: ``found``
* 303: ``see_other``, ``other``
* 304: ``not_modified``
* 305: ``use_proxy``
* 306: ``switch_proxy``
* 307: ``temporary_redirect``, ``temporary_moved``, ``temporary``
* 308: ``permanent_redirect``, ``resume_incomplete``, ``resume``
* 400: ``bad_request``, ``bad``
* 401: ``unauthorized``
* 402: ``payment_required``, ``payment``
* 403: ``forbidden``
* 404: ``not_found``, ``-o-``
* 405: ``method_not_allowed``, ``not_allowed``
* 406: ``not_acceptable``
* 407: ``proxy_authentication_required``, ``proxy_auth``, ``proxy_authentication``
* 408: ``request_timeout``, ``timeout``
* 409: ``conflict``
* 410: ``gone``
* 411: ``length_required``
* 412: ``precondition_failed``, ``precondition``
* 413: ``request_entity_too_large``, ``content_too_large``
* 414: ``request_uri_too_large``, ``uri_too_long``
* 415: ``unsupported_media_type``, ``unsupported_media``, ``media_type``
* 416: ``requested_range_not_satisfiable``, ``requested_range``, ``range_not_satisfiable``
* 417: ``expectation_failed``
* 418: ``im_a_teapot``, ``teapot``, ``i_am_a_teapot``
* 421: ``misdirected_request``
* 422: ``unprocessable_entity``, ``unprocessable``, ``unprocessable_content``
* 423: ``locked``
* 424: ``failed_dependency``, ``dependency``
* 425: ``unordered_collection``, ``unordered``, ``too_early``
* 426: ``upgrade_required``, ``upgrade``
* 428: ``precondition_required``, ``precondition``
* 429: ``too_many_requests``, ``too_many``
* 431: ``header_fields_too_large``, ``fields_too_large``
* 444: ``no_response``, ``none``
* 449: ``retry_with``, ``retry``
* 450: ``blocked_by_windows_parental_controls``, ``parental_controls``
* 451: ``unavailable_for_legal_reasons``, ``legal_reasons``
* 499: ``client_closed_request``
* 500: ``internal_server_error``, ``server_error``, ``/o\``, ``✗``
* 501: ``not_implemented``
* 502: ``bad_gateway``
* 503: ``service_unavailable``, ``unavailable``
* 504: ``gateway_timeout``
* 505: ``http_version_not_supported``, ``http_version``
* 506: ``variant_also_negotiates``
* 507: ``insufficient_storage``
* 509: ``bandwidth_limit_exceeded``, ``bandwidth``
* 510: ``not_extended``
* 511: ``network_authentication_required``, ``network_auth``, ``network_authentication``
DATA
__annotations__ = {'codes': requests.structures.LookupDict[int]}
codes = <lookup 'status_codes'>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\status_codes.py
requests.structures
Python Library Documentation: module requests.structures in requests
NAME
requests.structures
DESCRIPTION
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
CLASSES
builtins.dict(builtins.object)
LookupDict
collections.abc.MutableMapping(collections.abc.Mapping)
CaseInsensitiveDict(collections.abc.MutableMapping, typing.Generic)
typing.Generic(builtins.object)
CaseInsensitiveDict(collections.abc.MutableMapping, typing.Generic)
class CaseInsensitiveDict(collections.abc.MutableMapping, typing.Generic)
| CaseInsensitiveDict(data: 'Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None' = None, **kwargs: '_VT') -> 'None'
|
| A case-insensitive ``dict``-like object.
|
| Implements all methods and operations of
| ``MutableMapping`` as well as dict's ``copy``. Also
| provides ``lower_items``.
|
| All keys are expected to be strings. The structure remembers the
| case of the last key to be set, and ``iter(instance)``,
| ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
| will contain case-sensitive keys. However, querying and contains
| testing is case insensitive::
|
| cid = CaseInsensitiveDict()
| cid['Accept'] = 'application/json'
| cid['aCCEPT'] == 'application/json' # True
| list(cid) == ['Accept'] # True
|
| For example, ``headers['content-encoding']`` will return the
| value of a ``'Content-Encoding'`` response header, regardless
| of how the header name was originally stored.
|
| If the constructor, ``.update``, or equality comparison
| operations are given keys that have equal ``.lower()``s, the
| behavior is undefined.
|
| Method resolution order:
| CaseInsensitiveDict
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __delitem__(self, key: 'str') -> 'None'
|
| __eq__(self, other: 'object') -> 'bool'
| Return self==value.
|
| __getitem__(self, key: 'str') -> '_VT'
|
| __init__(self, data: 'Mapping[str, _VT] | Iterable[tuple[str, _VT]] | None' = None, **kwargs: '_VT') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'Iterator[str]'
|
| __len__(self) -> 'int'
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| __setitem__(self, key: 'str', value: '_VT') -> 'None'
|
| copy(self) -> 'CaseInsensitiveDict[_VT]'
| # Copy is required
|
| lower_items(self) -> 'Iterator[tuple[str, _VT]]'
| Like iteritems(), but with all lowercase keys.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'_store': 'OrderedDict[str, tuple[str, _VT]]'}
|
| __hash__ = None
|
| __orig_bases__ = (collections.abc.MutableMapping[str, ~_VT], typing.Ge...
|
| __parameters__ = (~_VT,)
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| pop(self, key, default=<object object at 0x00000235A7DB81F0>)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
| If key is not found, d is returned if given, otherwise KeyError is raised.
|
| popitem(self)
| D.popitem() -> (k, v), remove and return some (key, value) pair
| as a 2-tuple; but raise KeyError if D is empty.
|
| setdefault(self, key, default=None)
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| update(self, other=(), /, **kwds)
| D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
| If E present and has a .keys() method, does: for k in E: D[k] = E[k]
| If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
| In either case, this is followed by: for k, v in F.items(): D[k] = v
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| __contains__(self, key)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| items(self)
| D.items() -> a set-like object providing a view on D's items
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __init_subclass__(...)
| Function to initialize subclasses.
class LookupDict(builtins.dict)
| LookupDict(name: 'Any' = None) -> 'None'
|
| Dictionary lookup object.
|
| Method resolution order:
| LookupDict
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __getattr__(self, key: 'str') -> '_VT | None'
|
| __getitem__(self, key: 'str') -> '_VT | None'
| Return self[key].
|
| __init__(self, name: 'Any' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| get(self, key: 'str', default: '_D | None' = None) -> '_VT | _D | None'
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'name': 'Any'}
|
| __orig_bases__ = (dict[str, ~_VT],)
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __ror__(self, value, /)
| Return value|self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -> size of D in memory, in bytes
|
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| items(...)
| D.items() -> a set-like object providing a view on D's items
|
| keys(...)
| D.keys() -> a set-like object providing a view on D's keys
|
| pop(...)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
| If the key is not found, return the default if given; otherwise,
| raise a KeyError.
|
| popitem(self, /)
| Remove and return a (key, value) pair as a 2-tuple.
|
| Pairs are returned in LIFO (last-in, first-out) order.
| Raises KeyError if the dict is empty.
|
| setdefault(self, key, default=None, /)
| Insert key with a value of default if key is not in the dictionary.
|
| Return the value for key if key is in the dictionary, else default.
|
| update(...)
| D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
| If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
| If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
| In either case, this is followed by: for k in F: D[k] = F[k]
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.dict:
|
| __new__(*args, **kwargs) class method of builtins.dict
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from builtins.dict:
|
| __hash__ = None
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\structures.py
requests.urllib3
Python Library Documentation: package urllib3
NAME
urllib3 - Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more
PACKAGE CONTENTS
_base_connection
_collections
_request_methods
_version
connection
connectionpool
contrib (package)
exceptions
fields
filepost
http2 (package)
poolmanager
response
util (package)
CLASSES
builtins.object
urllib3.util.retry.Retry
urllib3.util.timeout.Timeout
collections.abc.MutableMapping(collections.abc.Mapping)
urllib3._collections.HTTPHeaderDict(collections.abc.MutableMapping, typing.Generic)
io.IOBase(_io._IOBase)
urllib3.response.BaseHTTPResponse
urllib3.response.HTTPResponse
typing.Generic(builtins.object)
urllib3._collections.HTTPHeaderDict(collections.abc.MutableMapping, typing.Generic)
urllib3._request_methods.RequestMethods(builtins.object)
urllib3.connectionpool.HTTPConnectionPool(urllib3.connectionpool.ConnectionPool, urllib3._request_methods.RequestMethods)
urllib3.connectionpool.HTTPSConnectionPool
urllib3.poolmanager.PoolManager
urllib3.poolmanager.ProxyManager
urllib3.connectionpool.ConnectionPool(builtins.object)
urllib3.connectionpool.HTTPConnectionPool(urllib3.connectionpool.ConnectionPool, urllib3._request_methods.RequestMethods)
urllib3.connectionpool.HTTPSConnectionPool
class BaseHTTPResponse(io.IOBase)
| BaseHTTPResponse(*, headers: 'typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None' = None, status: 'int', version: 'int', version_string: 'str', reason: 'str | None', decode_content: 'bool', request_url: 'str | None', retries: 'Retry | None' = None) -> 'None'
|
| Method resolution order:
| BaseHTTPResponse
| io.IOBase
| _io._IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, *, headers: 'typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None' = None, status: 'int', version: 'int', version_string: 'str', reason: 'str | None', decode_content: 'bool', request_url: 'str | None', retries: 'Retry | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| close(self) -> 'None'
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| drain_conn(self) -> 'None'
|
| get_redirect_location(self) -> 'str | None | typing.Literal[False]'
| Should we redirect and where to?
|
| :returns: Truthy redirect location string if we got a redirect status
| code and valid location. ``None`` if redirect status and no
| location. ``False`` if not a redirect status code.
|
| getheader(self, name: 'str', default: 'str | None' = None) -> 'str | None'
|
| getheaders(self) -> 'HTTPHeaderDict'
| # Methods used by dependent libraries
|
| geturl(self) -> 'str | None'
|
| info(self) -> 'HTTPHeaderDict'
| # Compatibility method for http.cookiejar
|
| json(self) -> 'typing.Any'
| Deserializes the body of the HTTP response as a Python object.
|
| The body of the HTTP response must be encoded using UTF-8, as per
| `RFC 8529 Section 8.1 <https://www.rfc-editor.org/rfc/rfc8259#section-8.1>`_.
|
| To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to
| your custom decoder instead.
|
| If the body of the HTTP response is not decodable to UTF-8, a
| `UnicodeDecodeError` will be raised. If the body of the HTTP response is not a
| valid JSON document, a `json.JSONDecodeError` will be raised.
|
| Read more :ref:`here <json_content>`.
|
| :returns: The body of the HTTP response as a Python object.
|
| read(self, amt: 'int | None' = None, decode_content: 'bool | None' = None, cache_content: 'bool' = False) -> 'bytes'
|
| read1(self, amt: 'int | None' = None, decode_content: 'bool | None' = None) -> 'bytes'
|
| read_chunked(self, amt: 'int | None' = None, decode_content: 'bool | None' = None) -> 'typing.Iterator[bytes]'
|
| readinto(self, b: 'bytearray | memoryview[int]') -> 'int'
| # Compatibility methods for `io` module
|
| release_conn(self) -> 'None'
|
| shutdown(self) -> 'None'
|
| stream(self, amt: 'int | None' = 65536, decode_content: 'bool | None' = None) -> 'typing.Iterator[bytes]'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| connection
|
| data
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| retries
|
| url
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CONTENT_DECODERS = ['gzip', 'x-gzip', 'deflate']
|
| DECODER_ERROR_CLASSES = (<class 'OSError'>, <class 'zlib.error'>)
|
| REDIRECT_STATUSES = [301, 302, 303, 307, 308]
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'DECODER_ERROR_CLASSES': 'tuple[type[Exception], .....
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| tell(self, /)
| Return current stream position.
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
|
| closed
class HTTPConnectionPool(ConnectionPool, urllib3._request_methods.RequestMethods)
| HTTPConnectionPool(host: 'str', port: 'int | None' = None, timeout: '_TYPE_TIMEOUT | None' = <_TYPE_DEFAULT.token: -1>, maxsize: 'int' = 1, block: 'bool' = False, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, _proxy: 'Url | None' = None, _proxy_headers: 'typing.Mapping[str, str] | None' = None, _proxy_config: 'ProxyConfig | None' = None, **conn_kw: 'typing.Any')
|
| Thread-safe connection pool for one host.
|
| :param host:
| Host used for this HTTP Connection (e.g. "localhost"), passed into
| :class:`http.client.HTTPConnection`.
|
| :param port:
| Port used for this HTTP Connection (None is equivalent to 80), passed
| into :class:`http.client.HTTPConnection`.
|
| :param timeout:
| Socket timeout in seconds for each individual connection. This can
| be a float or integer, which sets the timeout for the HTTP request,
| or an instance of :class:`urllib3.util.Timeout` which gives you more
| fine-grained control over request timeouts. After the constructor has
| been parsed, this is always a `urllib3.util.Timeout` object.
|
| :param maxsize:
| Number of connections to save that can be reused. More than 1 is useful
| in multithreaded situations. If ``block`` is set to False, more
| connections will be created but they will not be saved once they've
| been used.
|
| :param block:
| If set to True, no more than ``maxsize`` connections will be used at
| a time. When no free connections are available, the call will block
| until a connection has been released. This is a useful side effect for
| particular multithreaded situations where one does not want to use more
| than maxsize connections per host to prevent flooding.
|
| :param headers:
| Headers to include with all requests, unless other headers are given
| explicitly.
|
| :param retries:
| Retry configuration to use by default with requests in this pool.
|
| :param _proxy:
| Parsed proxy URL, should not be used directly, instead, see
| :class:`urllib3.ProxyManager`
|
| :param _proxy_headers:
| A dictionary with proxy headers, should not be used directly,
| instead, see :class:`urllib3.ProxyManager`
|
| :param \**conn_kw:
| Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`,
| :class:`urllib3.connection.HTTPSConnection` instances.
|
| Method resolution order:
| HTTPConnectionPool
| ConnectionPool
| urllib3._request_methods.RequestMethods
| builtins.object
|
| Methods defined here:
|
| __init__(self, host: 'str', port: 'int | None' = None, timeout: '_TYPE_TIMEOUT | None' = <_TYPE_DEFAULT.token: -1>, maxsize: 'int' = 1, block: 'bool' = False, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, _proxy: 'Url | None' = None, _proxy_headers: 'typing.Mapping[str, str] | None' = None, _proxy_config: 'ProxyConfig | None' = None, **conn_kw: 'typing.Any')
| Initialize self. See help(type(self)) for accurate signature.
|
| close(self) -> 'None'
| Close all pooled connections and disable the pool.
|
| is_same_host(self, url: 'str') -> 'bool'
| Check if the given ``url`` is a member of the same host as this
| connection pool.
|
| urlopen(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, redirect: 'bool' = True, assert_same_host: 'bool' = True, timeout: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>, pool_timeout: 'int | None' = None, release_conn: 'bool | None' = None, chunked: 'bool' = False, body_pos: '_TYPE_BODY_POSITION | None' = None, preload_content: 'bool' = True, decode_content: 'bool' = True, **response_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Get a connection from the pool and perform an HTTP request. This is the
| lowest level call for making a request, so you'll need to specify all
| the raw details.
|
| .. note::
|
| More commonly, it's appropriate to use a convenience method
| such as :meth:`request`.
|
| .. note::
|
| `release_conn` will only behave as expected if
| `preload_content=False` because we want to make
| `preload_content=False` the default behaviour someday soon without
| breaking backwards compatibility.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param retries:
| Configure the number of retries to allow before raising a
| :class:`~urllib3.exceptions.MaxRetryError` exception.
|
| If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a
| :class:`~urllib3.util.retry.Retry` object for fine-grained control
| over different types of retries.
| Pass an integer number to retry connection errors that many times,
| but no other types of errors. Pass zero to never retry.
|
| If ``False``, then retries are disabled and any exception is raised
| immediately. Also, instead of raising a MaxRetryError on redirects,
| the redirect response will be returned.
|
| :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
|
| :param redirect:
| If True, automatically handle redirects (status codes 301, 302,
| 303, 307, 308). Each redirect counts as a retry. Disabling retries
| will disable redirect, too.
|
| :param assert_same_host:
| If ``True``, will make sure that the host of the pool requests is
| consistent else will raise HostChangedError. When ``False``, you can
| use the pool on an HTTP proxy and request foreign hosts.
|
| :param timeout:
| If specified, overrides the default timeout for this one
| request. It may be a float (in seconds) or an instance of
| :class:`urllib3.util.Timeout`.
|
| :param pool_timeout:
| If set and the pool is set to block=True, then this method will
| block for ``pool_timeout`` seconds and raise EmptyPoolError if no
| connection is available within the time period.
|
| :param bool preload_content:
| If True, the response's body will be preloaded into memory.
|
| :param bool decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| :param release_conn:
| If False, then the urlopen call will not release the connection
| back into the pool once a response is received (but will release if
| you read the entire contents of the response such as when
| `preload_content=True`). This is useful if you're not preloading
| the response's content immediately. You will need to call
| ``r.release_conn()`` on the response ``r`` to return the connection
| back into the pool. If None, it takes the value of ``preload_content``
| which defaults to ``True``.
|
| :param bool chunked:
| If True, urllib3 will send the body using chunked transfer
| encoding. Otherwise, urllib3 will send the body using the standard
| content-length form. Defaults to False.
|
| :param int body_pos:
| Position to seek to in file-like body in the event of a retry or
| redirect. Typically this won't need to be set because urllib3 will
| auto-populate the value when needed.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ConnectionCls = <class 'urllib3.connection.HTTPConnection'>
| Based on :class:`http.client.HTTPConnection` but provides an extra constructor
| backwards-compatibility layer between older and newer Pythons.
|
| Additional keyword parameters are used to configure attributes of the connection.
| Accepted parameters include:
|
| - ``source_address``: Set the source address for the current connection.
| - ``socket_options``: Set specific options on the underlying socket. If not specified, then
| defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
| Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.
|
| For example, if you wish to enable TCP Keep Alive in addition to the defaults,
| you might pass:
|
| .. code-block:: python
|
| HTTPConnection.default_socket_options + [
| (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
| ]
|
| Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).
|
|
| __annotations__ = {'ConnectionCls': 'type[BaseHTTPConnection] | type[B...
|
| scheme = 'http'
|
| ----------------------------------------------------------------------
| Methods inherited from ConnectionPool:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'typing.Literal[False]'
|
| __str__(self) -> 'str'
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ConnectionPool:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ConnectionPool:
|
| QueueCls = <class 'queue.LifoQueue'>
| Variant of Queue that retrieves most recently added entries first.
|
|
| ----------------------------------------------------------------------
| Methods inherited from urllib3._request_methods.RequestMethods:
|
| request(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, json: 'typing.Any | None' = None, **urlopen_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the appropriate encoding of
| ``fields`` based on the ``method`` used.
|
| This is a convenience method that requires the least amount of manual
| effort. It can be used in most situations, while still having the
| option to drop down to more specific methods when necessary, such as
| :meth:`request_encode_url`, :meth:`request_encode_body`,
| or even the lowest level :meth:`urlopen`.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param fields:
| Data to encode and send in the URL or request body, depending on ``method``.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param json:
| Data to encode and send as JSON with UTF-encoded in the request body.
| The ``"Content-Type"`` header will be set to ``"application/json"``
| unless specified otherwise.
|
| request_encode_body(self, method: 'str', url: 'str', fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, encode_multipart: 'bool' = True, multipart_boundary: 'str | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the body. This is useful for request methods like POST, PUT, PATCH, etc.
|
| When ``encode_multipart=True`` (default), then
| :func:`urllib3.encode_multipart_formdata` is used to encode
| the payload with the appropriate content type. Otherwise
| :func:`urllib.parse.urlencode` is used with the
| 'application/x-www-form-urlencoded' content type.
|
| Multipart encoding must be used when posting files, and it's reasonably
| safe to use it in other times too. However, it may break request
| signing, such as with OAuth.
|
| Supports an optional ``fields`` parameter of key/value strings AND
| key/filetuple. A filetuple is a (filename, data, MIME type) tuple where
| the MIME type is optional. For example::
|
| fields = {
| 'foo': 'bar',
| 'fakefile': ('foofile.txt', 'contents of foofile'),
| 'realfile': ('barfile.txt', open('realfile').read()),
| 'typedfile': ('bazfile.bin', open('bazfile').read(),
| 'image/jpeg'),
| 'nonamefile': 'contents of nonamefile field',
| }
|
| When uploading a file, providing a filename (the first parameter of the
| tuple) is optional but recommended to best mimic behavior of browsers.
|
| Note that if ``headers`` are supplied, the 'Content-Type' header will
| be overwritten because it depends on the dynamic random boundary string
| which is used to compose the body of the request. The random boundary
| string can be explicitly set with the ``multipart_boundary`` parameter.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the request body.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param encode_multipart:
| If True, encode the ``fields`` using the multipart/form-data MIME
| format.
|
| :param multipart_boundary:
| If not specified, then a random boundary will be generated using
| :func:`urllib3.filepost.choose_boundary`.
|
| request_encode_url(self, method: 'str', url: 'str', fields: '_TYPE_ENCODE_URL_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the url. This is useful for request methods like GET, HEAD, DELETE, etc.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the URL.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
class HTTPHeaderDict(collections.abc.MutableMapping, typing.Generic)
| HTTPHeaderDict(headers: 'ValidHTTPHeaderSource | None' = None, **kwargs: 'str')
|
| :param headers:
| An iterable of field-value pairs. Must not contain multiple field names
| when compared case-insensitively.
|
| :param kwargs:
| Additional field-value pairs to pass in to ``dict.update``.
|
| A ``dict`` like container for storing HTTP Headers.
|
| Field names are stored and compared case-insensitively in compliance with
| RFC 7230. Iteration provides the first case-sensitive key seen for each
| case-insensitive pair.
|
| Using ``__setitem__`` syntax overwrites fields that compare equal
| case-insensitively in order to maintain ``dict``'s api. For fields that
| compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add``
| in a loop.
|
| If multiple fields that are equal case-insensitively are passed to the
| constructor or ``.update``, the behavior is undefined and some will be
| lost.
|
| >>> headers = HTTPHeaderDict()
| >>> headers.add('Set-Cookie', 'foo=bar')
| >>> headers.add('set-cookie', 'baz=quxx')
| >>> headers['content-length'] = '7'
| >>> headers['SET-cookie']
| 'foo=bar, baz=quxx'
| >>> headers['Content-Length']
| '7'
|
| Method resolution order:
| HTTPHeaderDict
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| typing.Generic
| builtins.object
|
| Methods defined here:
|
| __contains__(self, key: 'object') -> 'bool'
|
| __delitem__(self, key: 'str') -> 'None'
|
| __eq__(self, other: 'object') -> 'bool'
| Return self==value.
|
| __getitem__(self, key: 'str') -> 'str'
|
| __init__(self, headers: 'ValidHTTPHeaderSource | None' = None, **kwargs: 'str')
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other: 'object') -> 'HTTPHeaderDict'
|
| __iter__(self) -> 'typing.Iterator[str]'
|
| __len__(self) -> 'int'
|
| __ne__(self, other: 'object') -> 'bool'
| Return self!=value.
|
| __or__(self, other: 'object') -> 'Self'
| Return self|value.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| __ror__(self, other: 'object') -> 'Self'
| Return value|self.
|
| __setitem__(self, key: 'str', val: 'str') -> 'None'
|
| add(self, key: 'str', val: 'str', *, combine: 'bool' = False) -> 'None'
| Adds a (name, value) pair, doesn't overwrite the value if it already
| exists.
|
| If this is called with combine=True, instead of adding a new header value
| as a distinct item during iteration, this will instead append the value to
| any existing header value with a comma. If no existing header value exists
| for the key, then the value will simply be added, ignoring the combine parameter.
|
| >>> headers = HTTPHeaderDict(foo='bar')
| >>> headers.add('Foo', 'baz')
| >>> headers['foo']
| 'bar, baz'
| >>> list(headers.items())
| [('foo', 'bar'), ('foo', 'baz')]
| >>> headers.add('foo', 'quz', combine=True)
| >>> list(headers.items())
| [('foo', 'bar, baz, quz')]
|
| copy(self) -> 'Self'
|
| discard(self, key: 'str') -> 'None'
|
| extend(self, *args: 'ValidHTTPHeaderSource', **kwargs: 'str') -> 'None'
| Generic import function for any type of header-like object.
| Adapted version of MutableMapping.update in order to insert items
| with self.add instead of self.__setitem__
|
| get_all = getlist(self, key: 'str', default: '_Sentinel | _DT' = <_Sentinel.not_passed: 1>) -> 'list[str] | _DT'
|
| getallmatchingheaders = getlist(self, key: 'str', default: '_Sentinel | _DT' = <_Sentinel.not_passed: 1>) -> 'list[str] | _DT'
|
| getheaders = getlist(self, key: 'str', default: '_Sentinel | _DT' = <_Sentinel.not_passed: 1>) -> 'list[str] | _DT'
|
| getlist(self, key: 'str', default: '_Sentinel | _DT' = <_Sentinel.not_passed: 1>) -> 'list[str] | _DT'
| Returns a list of all the values for the named field. Returns an
| empty list if the key doesn't exist.
|
| iget = getlist(self, key: 'str', default: '_Sentinel | _DT' = <_Sentinel.not_passed: 1>) -> 'list[str] | _DT'
|
| items(self) -> 'HTTPHeaderDictItemView'
| D.items() -> a set-like object providing a view on D's items
|
| iteritems(self) -> 'typing.Iterator[tuple[str, str]]'
| Iterate over all header lines, including duplicate ones.
|
| itermerged(self) -> 'typing.Iterator[tuple[str, str]]'
| Iterate over all headers, merging duplicate ones together.
|
| setdefault(self, key: 'str', default: 'str' = '') -> 'str'
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {'_container': 'typing.MutableMapping[str, list[str]...
|
| __hash__ = None
|
| __orig_bases__ = (typing.MutableMapping[str, str],)
|
| __parameters__ = ()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| pop(self, key, default=<object object at 0x00000235A7DB81F0>)
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
| If key is not found, d is returned if given, otherwise KeyError is raised.
|
| popitem(self)
| D.popitem() -> (k, v), remove and return some (key, value) pair
| as a 2-tuple; but raise KeyError if D is empty.
|
| update(self, other=(), /, **kwds)
| D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
| If E present and has a .keys() method, does: for k in E: D[k] = E[k]
| If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
| In either case, this is followed by: for k, v in F.items(): D[k] = v
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Mapping:
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| keys(self)
| D.keys() -> a set-like object providing a view on D's keys
|
| values(self)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from collections.abc.Mapping:
|
| __reversed__ = None
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Collection:
|
| __subclasshook__(C)
| Abstract classes can override this to customize issubclass().
|
| This is invoked early on by abc.ABCMeta.__subclasscheck__().
| It should return True, False or NotImplemented. If it returns
| NotImplemented, the normal algorithm is used. Otherwise, it
| overrides the normal algorithm (and the outcome is cached).
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Iterable:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| ----------------------------------------------------------------------
| Class methods inherited from typing.Generic:
|
| __init_subclass__(...)
| Function to initialize subclasses.
class HTTPResponse(BaseHTTPResponse)
| HTTPResponse(body: '_TYPE_BODY' = '', headers: 'typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None' = None, status: 'int' = 0, version: 'int' = 0, version_string: 'str' = 'HTTP/?', reason: 'str | None' = None, preload_content: 'bool' = True, decode_content: 'bool' = True, original_response: '_HttplibHTTPResponse | None' = None, pool: 'HTTPConnectionPool | None' = None, connection: 'HTTPConnection | None' = None, msg: '_HttplibHTTPMessage | None' = None, retries: 'Retry | None' = None, enforce_content_length: 'bool' = True, request_method: 'str | None' = None, request_url: 'str | None' = None, auto_close: 'bool' = True, sock_shutdown: 'typing.Callable[[int], None] | None' = None) -> 'None'
|
| HTTP Response container.
|
| Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is
| loaded and decoded on-demand when the ``data`` property is accessed. This
| class is also compatible with the Python standard library's :mod:`io`
| module, and can hence be treated as a readable object in the context of that
| framework.
|
| Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`:
|
| :param preload_content:
| If True, the response's body will be preloaded during construction.
|
| :param decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| :param original_response:
| When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse`
| object, it's convenient to include the original for debug purposes. It's
| otherwise unused.
|
| :param retries:
| The retries contains the last :class:`~urllib3.util.retry.Retry` that
| was used during the request.
|
| :param enforce_content_length:
| Enforce content length checking. Body returned by server must match
| value of Content-Length header, if present. Otherwise, raise error.
|
| Method resolution order:
| HTTPResponse
| BaseHTTPResponse
| io.IOBase
| _io._IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, body: '_TYPE_BODY' = '', headers: 'typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None' = None, status: 'int' = 0, version: 'int' = 0, version_string: 'str' = 'HTTP/?', reason: 'str | None' = None, preload_content: 'bool' = True, decode_content: 'bool' = True, original_response: '_HttplibHTTPResponse | None' = None, pool: 'HTTPConnectionPool | None' = None, connection: 'HTTPConnection | None' = None, msg: '_HttplibHTTPMessage | None' = None, retries: 'Retry | None' = None, enforce_content_length: 'bool' = True, request_method: 'str | None' = None, request_url: 'str | None' = None, auto_close: 'bool' = True, sock_shutdown: 'typing.Callable[[int], None] | None' = None) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self) -> 'typing.Iterator[bytes]'
| Implement iter(self).
|
| close(self) -> 'None'
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| drain_conn(self) -> 'None'
| Read and discard any remaining HTTP response data in the response connection.
|
| Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.
|
| fileno(self) -> 'int'
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| flush(self) -> 'None'
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isclosed(self) -> 'bool'
|
| read(self, amt: 'int | None' = None, decode_content: 'bool | None' = None, cache_content: 'bool' = False) -> 'bytes'
| Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
| parameters: ``decode_content`` and ``cache_content``.
|
| :param amt:
| How much of the content to read. If specified, caching is skipped
| because it doesn't make sense to cache partial content as the full
| response.
|
| :param decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| :param cache_content:
| If True, will save the returned data such that the same result is
| returned despite of the state of the underlying file object. This
| is useful if you want the ``.data`` property to continue working
| after having ``.read()`` the file object. (Overridden if ``amt`` is
| set.)
|
| read1(self, amt: 'int | None' = None, decode_content: 'bool | None' = None) -> 'bytes'
| Similar to ``http.client.HTTPResponse.read1`` and documented
| in :meth:`io.BufferedReader.read1`, but with an additional parameter:
| ``decode_content``.
|
| :param amt:
| How much of the content to read.
|
| :param decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| read_chunked(self, amt: 'int | None' = None, decode_content: 'bool | None' = None) -> 'typing.Generator[bytes]'
| Similar to :meth:`HTTPResponse.read`, but with an additional
| parameter: ``decode_content``.
|
| :param amt:
| How much of the content to read. If specified, caching is skipped
| because it doesn't make sense to cache partial content as the full
| response.
|
| :param decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| readable(self) -> 'bool'
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| release_conn(self) -> 'None'
|
| shutdown(self) -> 'None'
|
| stream(self, amt: 'int | None' = 65536, decode_content: 'bool | None' = None) -> 'typing.Generator[bytes]'
| A generator wrapper for the read() method. A call will block until
| ``amt`` bytes have been read from the connection or until the
| connection is closed.
|
| :param amt:
| How much of the content to read. The generator will return up to
| much data per iteration, but may return less. This is particularly
| likely when using compressed data. However, the empty string will
| never be returned.
|
| :param decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| supports_chunked_reads(self) -> 'bool'
| Checks if the underlying file-like object looks like a
| :class:`http.client.HTTPResponse` object. We do this by testing for
| the fp attribute. If it is present we assume it returns raw chunks as
| processed by read_chunked().
|
| tell(self) -> 'int'
| Obtain the number of bytes pulled over the wire so far. May differ from
| the amount of content returned by :meth:`HTTPResponse.read`
| if bytes are encoded on the wire (e.g, compressed).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| closed
|
| connection
|
| data
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| url
| Returns the URL that was the source of this response.
| If the request that generated this response redirected, this method
| will return the final redirect location.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHTTPResponse:
|
| get_redirect_location(self) -> 'str | None | typing.Literal[False]'
| Should we redirect and where to?
|
| :returns: Truthy redirect location string if we got a redirect status
| code and valid location. ``None`` if redirect status and no
| location. ``False`` if not a redirect status code.
|
| getheader(self, name: 'str', default: 'str | None' = None) -> 'str | None'
|
| getheaders(self) -> 'HTTPHeaderDict'
| # Methods used by dependent libraries
|
| geturl(self) -> 'str | None'
|
| info(self) -> 'HTTPHeaderDict'
| # Compatibility method for http.cookiejar
|
| json(self) -> 'typing.Any'
| Deserializes the body of the HTTP response as a Python object.
|
| The body of the HTTP response must be encoded using UTF-8, as per
| `RFC 8529 Section 8.1 <https://www.rfc-editor.org/rfc/rfc8259#section-8.1>`_.
|
| To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to
| your custom decoder instead.
|
| If the body of the HTTP response is not decodable to UTF-8, a
| `UnicodeDecodeError` will be raised. If the body of the HTTP response is not a
| valid JSON document, a `json.JSONDecodeError` will be raised.
|
| Read more :ref:`here <json_content>`.
|
| :returns: The body of the HTTP response as a Python object.
|
| readinto(self, b: 'bytearray | memoryview[int]') -> 'int'
| # Compatibility methods for `io` module
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHTTPResponse:
|
| retries
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHTTPResponse:
|
| CONTENT_DECODERS = ['gzip', 'x-gzip', 'deflate']
|
| DECODER_ERROR_CLASSES = (<class 'OSError'>, <class 'zlib.error'>)
|
| REDIRECT_STATUSES = [301, 302, 303, 307, 308]
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __next__(self, /)
| Implement next(self).
|
| isatty(self, /)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| readline(self, size=-1, /)
| Read and return a line from the stream.
|
| If size is specified, at most size bytes will be read.
|
| The line terminator is always b'\n' for binary files; for text
| files, the newlines argument to open can be used to select the line
| terminator(s) recognized.
|
| readlines(self, hint=-1, /)
| Return a list of lines from the stream.
|
| hint can be specified to control the number of lines read: no more
| lines will be read if the total size (in bytes/characters) of all
| lines so far exceeds hint.
|
| seek(self, offset, whence=0, /)
| Change the stream position to the given byte offset.
|
| offset
| The stream position, relative to 'whence'.
| whence
| The relative position to seek from.
|
| The offset is interpreted relative to the position indicated by whence.
| Values for whence are:
|
| * os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
| * os.SEEK_CUR or 1 -- current stream position; offset may be negative
| * os.SEEK_END or 2 -- end of stream; offset is usually negative
|
| Return the new absolute position.
|
| seekable(self, /)
| Return whether object supports random access.
|
| If False, seek(), tell() and truncate() will raise OSError.
| This method may need to do a test seek().
|
| truncate(self, size=None, /)
| Truncate file to size bytes.
|
| File pointer is left unchanged. Size defaults to the current IO position
| as reported by tell(). Return the new size.
|
| writable(self, /)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| writelines(self, lines, /)
| Write a list of lines to stream.
|
| Line separators are not added, so it is usual for each of the
| lines provided to have a line separator at the end.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
class HTTPSConnectionPool(HTTPConnectionPool)
| HTTPSConnectionPool(host: 'str', port: 'int | None' = None, timeout: '_TYPE_TIMEOUT | None' = <_TYPE_DEFAULT.token: -1>, maxsize: 'int' = 1, block: 'bool' = False, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, _proxy: 'Url | None' = None, _proxy_headers: 'typing.Mapping[str, str] | None' = None, key_file: 'str | None' = None, cert_file: 'str | None' = None, cert_reqs: 'int | str | None' = None, key_password: 'str | None' = None, ca_certs: 'str | None' = None, ssl_version: 'int | str | None' = None, ssl_minimum_version: 'ssl.TLSVersion | None' = None, ssl_maximum_version: 'ssl.TLSVersion | None' = None, assert_hostname: 'str | typing.Literal[False] | None' = None, assert_fingerprint: 'str | None' = None, ca_cert_dir: 'str | None' = None, **conn_kw: 'typing.Any') -> 'None'
|
| Same as :class:`.HTTPConnectionPool`, but HTTPS.
|
| :class:`.HTTPSConnection` uses one of ``assert_fingerprint``,
| ``assert_hostname`` and ``host`` in this order to verify connections.
| If ``assert_hostname`` is False, no verification is done.
|
| The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``,
| ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl`
| is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade
| the connection socket into an SSL socket.
|
| Method resolution order:
| HTTPSConnectionPool
| HTTPConnectionPool
| ConnectionPool
| urllib3._request_methods.RequestMethods
| builtins.object
|
| Methods defined here:
|
| __init__(self, host: 'str', port: 'int | None' = None, timeout: '_TYPE_TIMEOUT | None' = <_TYPE_DEFAULT.token: -1>, maxsize: 'int' = 1, block: 'bool' = False, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, _proxy: 'Url | None' = None, _proxy_headers: 'typing.Mapping[str, str] | None' = None, key_file: 'str | None' = None, cert_file: 'str | None' = None, cert_reqs: 'int | str | None' = None, key_password: 'str | None' = None, ca_certs: 'str | None' = None, ssl_version: 'int | str | None' = None, ssl_minimum_version: 'ssl.TLSVersion | None' = None, ssl_maximum_version: 'ssl.TLSVersion | None' = None, assert_hostname: 'str | typing.Literal[False] | None' = None, assert_fingerprint: 'str | None' = None, ca_cert_dir: 'str | None' = None, **conn_kw: 'typing.Any') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ConnectionCls = <class 'urllib3.connection.HTTPSConnection'>
| Many of the parameters to this constructor are passed to the underlying SSL
| socket by means of :py:func:`urllib3.util.ssl_wrap_socket`.
|
|
| __annotations__ = {'ConnectionCls': 'type[BaseHTTPSConnection]'}
|
| scheme = 'https'
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPConnectionPool:
|
| close(self) -> 'None'
| Close all pooled connections and disable the pool.
|
| is_same_host(self, url: 'str') -> 'bool'
| Check if the given ``url`` is a member of the same host as this
| connection pool.
|
| urlopen(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, headers: 'typing.Mapping[str, str] | None' = None, retries: 'Retry | bool | int | None' = None, redirect: 'bool' = True, assert_same_host: 'bool' = True, timeout: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>, pool_timeout: 'int | None' = None, release_conn: 'bool | None' = None, chunked: 'bool' = False, body_pos: '_TYPE_BODY_POSITION | None' = None, preload_content: 'bool' = True, decode_content: 'bool' = True, **response_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Get a connection from the pool and perform an HTTP request. This is the
| lowest level call for making a request, so you'll need to specify all
| the raw details.
|
| .. note::
|
| More commonly, it's appropriate to use a convenience method
| such as :meth:`request`.
|
| .. note::
|
| `release_conn` will only behave as expected if
| `preload_content=False` because we want to make
| `preload_content=False` the default behaviour someday soon without
| breaking backwards compatibility.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param retries:
| Configure the number of retries to allow before raising a
| :class:`~urllib3.exceptions.MaxRetryError` exception.
|
| If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a
| :class:`~urllib3.util.retry.Retry` object for fine-grained control
| over different types of retries.
| Pass an integer number to retry connection errors that many times,
| but no other types of errors. Pass zero to never retry.
|
| If ``False``, then retries are disabled and any exception is raised
| immediately. Also, instead of raising a MaxRetryError on redirects,
| the redirect response will be returned.
|
| :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
|
| :param redirect:
| If True, automatically handle redirects (status codes 301, 302,
| 303, 307, 308). Each redirect counts as a retry. Disabling retries
| will disable redirect, too.
|
| :param assert_same_host:
| If ``True``, will make sure that the host of the pool requests is
| consistent else will raise HostChangedError. When ``False``, you can
| use the pool on an HTTP proxy and request foreign hosts.
|
| :param timeout:
| If specified, overrides the default timeout for this one
| request. It may be a float (in seconds) or an instance of
| :class:`urllib3.util.Timeout`.
|
| :param pool_timeout:
| If set and the pool is set to block=True, then this method will
| block for ``pool_timeout`` seconds and raise EmptyPoolError if no
| connection is available within the time period.
|
| :param bool preload_content:
| If True, the response's body will be preloaded into memory.
|
| :param bool decode_content:
| If True, will attempt to decode the body based on the
| 'content-encoding' header.
|
| :param release_conn:
| If False, then the urlopen call will not release the connection
| back into the pool once a response is received (but will release if
| you read the entire contents of the response such as when
| `preload_content=True`). This is useful if you're not preloading
| the response's content immediately. You will need to call
| ``r.release_conn()`` on the response ``r`` to return the connection
| back into the pool. If None, it takes the value of ``preload_content``
| which defaults to ``True``.
|
| :param bool chunked:
| If True, urllib3 will send the body using chunked transfer
| encoding. Otherwise, urllib3 will send the body using the standard
| content-length form. Defaults to False.
|
| :param int body_pos:
| Position to seek to in file-like body in the event of a retry or
| redirect. Typically this won't need to be set because urllib3 will
| auto-populate the value when needed.
|
| ----------------------------------------------------------------------
| Methods inherited from ConnectionPool:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'typing.Literal[False]'
|
| __str__(self) -> 'str'
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ConnectionPool:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ConnectionPool:
|
| QueueCls = <class 'queue.LifoQueue'>
| Variant of Queue that retrieves most recently added entries first.
|
|
| ----------------------------------------------------------------------
| Methods inherited from urllib3._request_methods.RequestMethods:
|
| request(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, json: 'typing.Any | None' = None, **urlopen_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the appropriate encoding of
| ``fields`` based on the ``method`` used.
|
| This is a convenience method that requires the least amount of manual
| effort. It can be used in most situations, while still having the
| option to drop down to more specific methods when necessary, such as
| :meth:`request_encode_url`, :meth:`request_encode_body`,
| or even the lowest level :meth:`urlopen`.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param fields:
| Data to encode and send in the URL or request body, depending on ``method``.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param json:
| Data to encode and send as JSON with UTF-encoded in the request body.
| The ``"Content-Type"`` header will be set to ``"application/json"``
| unless specified otherwise.
|
| request_encode_body(self, method: 'str', url: 'str', fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, encode_multipart: 'bool' = True, multipart_boundary: 'str | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the body. This is useful for request methods like POST, PUT, PATCH, etc.
|
| When ``encode_multipart=True`` (default), then
| :func:`urllib3.encode_multipart_formdata` is used to encode
| the payload with the appropriate content type. Otherwise
| :func:`urllib.parse.urlencode` is used with the
| 'application/x-www-form-urlencoded' content type.
|
| Multipart encoding must be used when posting files, and it's reasonably
| safe to use it in other times too. However, it may break request
| signing, such as with OAuth.
|
| Supports an optional ``fields`` parameter of key/value strings AND
| key/filetuple. A filetuple is a (filename, data, MIME type) tuple where
| the MIME type is optional. For example::
|
| fields = {
| 'foo': 'bar',
| 'fakefile': ('foofile.txt', 'contents of foofile'),
| 'realfile': ('barfile.txt', open('realfile').read()),
| 'typedfile': ('bazfile.bin', open('bazfile').read(),
| 'image/jpeg'),
| 'nonamefile': 'contents of nonamefile field',
| }
|
| When uploading a file, providing a filename (the first parameter of the
| tuple) is optional but recommended to best mimic behavior of browsers.
|
| Note that if ``headers`` are supplied, the 'Content-Type' header will
| be overwritten because it depends on the dynamic random boundary string
| which is used to compose the body of the request. The random boundary
| string can be explicitly set with the ``multipart_boundary`` parameter.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the request body.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param encode_multipart:
| If True, encode the ``fields`` using the multipart/form-data MIME
| format.
|
| :param multipart_boundary:
| If not specified, then a random boundary will be generated using
| :func:`urllib3.filepost.choose_boundary`.
|
| request_encode_url(self, method: 'str', url: 'str', fields: '_TYPE_ENCODE_URL_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the url. This is useful for request methods like GET, HEAD, DELETE, etc.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the URL.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
class PoolManager(urllib3._request_methods.RequestMethods)
| PoolManager(num_pools: 'int' = 10, headers: 'typing.Mapping[str, str] | None' = None, **connection_pool_kw: 'typing.Any') -> 'None'
|
| Allows for arbitrary requests while transparently keeping track of
| necessary connection pools for you.
|
| :param num_pools:
| Number of connection pools to cache before discarding the least
| recently used pool.
|
| :param headers:
| Headers to include with all requests, unless other headers are given
| explicitly.
|
| :param \**connection_pool_kw:
| Additional parameters are used to create fresh
| :class:`urllib3.connectionpool.ConnectionPool` instances.
|
| Example:
|
| .. code-block:: python
|
| import urllib3
|
| http = urllib3.PoolManager(num_pools=2)
|
| resp1 = http.request("GET", "https://google.com/")
| resp2 = http.request("GET", "https://google.com/mail")
| resp3 = http.request("GET", "https://yahoo.com/")
|
| print(len(http.pools))
| # 2
|
| Method resolution order:
| PoolManager
| urllib3._request_methods.RequestMethods
| builtins.object
|
| Methods defined here:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'typing.Literal[False]'
|
| __init__(self, num_pools: 'int' = 10, headers: 'typing.Mapping[str, str] | None' = None, **connection_pool_kw: 'typing.Any') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| clear(self) -> 'None'
| Empty our store of pools and direct them all to close.
|
| This will not affect in-flight connections, but they will not be
| re-used after completion.
|
| connection_from_context(self, request_context: 'dict[str, typing.Any]') -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context.
|
| ``request_context`` must at least contain the ``scheme`` key and its
| value must be a key in ``key_fn_by_scheme`` instance variable.
|
| connection_from_host(self, host: 'str | None', port: 'int | None' = None, scheme: 'str | None' = 'http', pool_kwargs: 'dict[str, typing.Any] | None' = None) -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme.
|
| If ``port`` isn't given, it will be derived from the ``scheme`` using
| ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is
| provided, it is merged with the instance's ``connection_pool_kw``
| variable and used to create the new connection pool, if one is
| needed.
|
| connection_from_pool_key(self, pool_key: 'PoolKey', request_context: 'dict[str, typing.Any]') -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key.
|
| ``pool_key`` should be a namedtuple that only contains immutable
| objects. At a minimum it must have the ``scheme``, ``host``, and
| ``port`` fields.
|
| connection_from_url(self, url: 'str', pool_kwargs: 'dict[str, typing.Any] | None' = None) -> 'HTTPConnectionPool'
| Similar to :func:`urllib3.connectionpool.connection_from_url`.
|
| If ``pool_kwargs`` is not provided and a new pool needs to be
| constructed, ``self.connection_pool_kw`` is used to initialize
| the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs``
| is provided, it is used instead. Note that if a new pool does not
| need to be created for the request, the provided ``pool_kwargs`` are
| not used.
|
| urlopen(self, method: 'str', url: 'str', redirect: 'bool' = True, **kw: 'typing.Any') -> 'BaseHTTPResponse'
| Same as :meth:`urllib3.HTTPConnectionPool.urlopen`
| with custom cross-host redirect logic and only sends the request-uri
| portion of the ``url``.
|
| The given ``url`` parameter must be absolute, such that an appropriate
| :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'proxy': 'Url | None', 'proxy_config': 'ProxyConfig...
|
| proxy = None
|
| proxy_config = None
|
| ----------------------------------------------------------------------
| Methods inherited from urllib3._request_methods.RequestMethods:
|
| request(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, json: 'typing.Any | None' = None, **urlopen_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the appropriate encoding of
| ``fields`` based on the ``method`` used.
|
| This is a convenience method that requires the least amount of manual
| effort. It can be used in most situations, while still having the
| option to drop down to more specific methods when necessary, such as
| :meth:`request_encode_url`, :meth:`request_encode_body`,
| or even the lowest level :meth:`urlopen`.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param fields:
| Data to encode and send in the URL or request body, depending on ``method``.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param json:
| Data to encode and send as JSON with UTF-encoded in the request body.
| The ``"Content-Type"`` header will be set to ``"application/json"``
| unless specified otherwise.
|
| request_encode_body(self, method: 'str', url: 'str', fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, encode_multipart: 'bool' = True, multipart_boundary: 'str | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the body. This is useful for request methods like POST, PUT, PATCH, etc.
|
| When ``encode_multipart=True`` (default), then
| :func:`urllib3.encode_multipart_formdata` is used to encode
| the payload with the appropriate content type. Otherwise
| :func:`urllib.parse.urlencode` is used with the
| 'application/x-www-form-urlencoded' content type.
|
| Multipart encoding must be used when posting files, and it's reasonably
| safe to use it in other times too. However, it may break request
| signing, such as with OAuth.
|
| Supports an optional ``fields`` parameter of key/value strings AND
| key/filetuple. A filetuple is a (filename, data, MIME type) tuple where
| the MIME type is optional. For example::
|
| fields = {
| 'foo': 'bar',
| 'fakefile': ('foofile.txt', 'contents of foofile'),
| 'realfile': ('barfile.txt', open('realfile').read()),
| 'typedfile': ('bazfile.bin', open('bazfile').read(),
| 'image/jpeg'),
| 'nonamefile': 'contents of nonamefile field',
| }
|
| When uploading a file, providing a filename (the first parameter of the
| tuple) is optional but recommended to best mimic behavior of browsers.
|
| Note that if ``headers`` are supplied, the 'Content-Type' header will
| be overwritten because it depends on the dynamic random boundary string
| which is used to compose the body of the request. The random boundary
| string can be explicitly set with the ``multipart_boundary`` parameter.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the request body.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param encode_multipart:
| If True, encode the ``fields`` using the multipart/form-data MIME
| format.
|
| :param multipart_boundary:
| If not specified, then a random boundary will be generated using
| :func:`urllib3.filepost.choose_boundary`.
|
| request_encode_url(self, method: 'str', url: 'str', fields: '_TYPE_ENCODE_URL_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the url. This is useful for request methods like GET, HEAD, DELETE, etc.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the URL.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from urllib3._request_methods.RequestMethods:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ProxyManager(PoolManager)
| ProxyManager(proxy_url: 'str', num_pools: 'int' = 10, headers: 'typing.Mapping[str, str] | None' = None, proxy_headers: 'typing.Mapping[str, str] | None' = None, proxy_ssl_context: 'ssl.SSLContext | None' = None, use_forwarding_for_https: 'bool' = False, proxy_assert_hostname: 'None | str | typing.Literal[False]' = None, proxy_assert_fingerprint: 'str | None' = None, **connection_pool_kw: 'typing.Any') -> 'None'
|
| Behaves just like :class:`PoolManager`, but sends all requests through
| the defined proxy, using the CONNECT method for HTTPS URLs.
|
| :param proxy_url:
| The URL of the proxy to be used.
|
| :param proxy_headers:
| A dictionary containing headers that will be sent to the proxy. In case
| of HTTP they are being sent with each request, while in the
| HTTPS/CONNECT case they are sent only once. Could be used for proxy
| authentication.
|
| :param proxy_ssl_context:
| The proxy SSL context is used to establish the TLS connection to the
| proxy when using HTTPS proxies.
|
| :param use_forwarding_for_https:
| (Defaults to False) If set to True will forward requests to the HTTPS
| proxy to be made on behalf of the client instead of creating a TLS
| tunnel via the CONNECT method. **Enabling this flag means that request
| and response headers and content will be visible from the HTTPS proxy**
| whereas tunneling keeps request and response headers and content
| private. IP address, target hostname, SNI, and port are always visible
| to an HTTPS proxy even when this flag is disabled.
|
| :param proxy_assert_hostname:
| The hostname of the certificate to verify against.
|
| :param proxy_assert_fingerprint:
| The fingerprint of the certificate to verify against.
|
| Example:
|
| .. code-block:: python
|
| import urllib3
|
| proxy = urllib3.ProxyManager("https://localhost:3128/")
|
| resp1 = proxy.request("GET", "http://google.com/")
| resp2 = proxy.request("GET", "http://httpbin.org/")
|
| # One pool was shared by both plain HTTP requests.
| print(len(proxy.pools))
| # 1
|
| resp3 = proxy.request("GET", "https://httpbin.org/")
| resp4 = proxy.request("GET", "https://twitter.com/")
|
| # A separate pool was added for each HTTPS target.
| print(len(proxy.pools))
| # 3
|
| Method resolution order:
| ProxyManager
| PoolManager
| urllib3._request_methods.RequestMethods
| builtins.object
|
| Methods defined here:
|
| __init__(self, proxy_url: 'str', num_pools: 'int' = 10, headers: 'typing.Mapping[str, str] | None' = None, proxy_headers: 'typing.Mapping[str, str] | None' = None, proxy_ssl_context: 'ssl.SSLContext | None' = None, use_forwarding_for_https: 'bool' = False, proxy_assert_hostname: 'None | str | typing.Literal[False]' = None, proxy_assert_fingerprint: 'str | None' = None, **connection_pool_kw: 'typing.Any') -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| connection_from_host(self, host: 'str | None', port: 'int | None' = None, scheme: 'str | None' = 'http', pool_kwargs: 'dict[str, typing.Any] | None' = None) -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme.
|
| If ``port`` isn't given, it will be derived from the ``scheme`` using
| ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is
| provided, it is merged with the instance's ``connection_pool_kw``
| variable and used to create the new connection pool, if one is
| needed.
|
| urlopen(self, method: 'str', url: 'str', redirect: 'bool' = True, **kw: 'typing.Any') -> 'BaseHTTPResponse'
| Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from PoolManager:
|
| __enter__(self) -> 'Self'
|
| __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'typing.Literal[False]'
|
| clear(self) -> 'None'
| Empty our store of pools and direct them all to close.
|
| This will not affect in-flight connections, but they will not be
| re-used after completion.
|
| connection_from_context(self, request_context: 'dict[str, typing.Any]') -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context.
|
| ``request_context`` must at least contain the ``scheme`` key and its
| value must be a key in ``key_fn_by_scheme`` instance variable.
|
| connection_from_pool_key(self, pool_key: 'PoolKey', request_context: 'dict[str, typing.Any]') -> 'HTTPConnectionPool'
| Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key.
|
| ``pool_key`` should be a namedtuple that only contains immutable
| objects. At a minimum it must have the ``scheme``, ``host``, and
| ``port`` fields.
|
| connection_from_url(self, url: 'str', pool_kwargs: 'dict[str, typing.Any] | None' = None) -> 'HTTPConnectionPool'
| Similar to :func:`urllib3.connectionpool.connection_from_url`.
|
| If ``pool_kwargs`` is not provided and a new pool needs to be
| constructed, ``self.connection_pool_kw`` is used to initialize
| the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs``
| is provided, it is used instead. Note that if a new pool does not
| need to be created for the request, the provided ``pool_kwargs`` are
| not used.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from PoolManager:
|
| proxy = None
|
| proxy_config = None
|
| ----------------------------------------------------------------------
| Methods inherited from urllib3._request_methods.RequestMethods:
|
| request(self, method: 'str', url: 'str', body: '_TYPE_BODY | None' = None, fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, json: 'typing.Any | None' = None, **urlopen_kw: 'typing.Any') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the appropriate encoding of
| ``fields`` based on the ``method`` used.
|
| This is a convenience method that requires the least amount of manual
| effort. It can be used in most situations, while still having the
| option to drop down to more specific methods when necessary, such as
| :meth:`request_encode_url`, :meth:`request_encode_body`,
| or even the lowest level :meth:`urlopen`.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param body:
| Data to send in the request body, either :class:`str`, :class:`bytes`,
| an iterable of :class:`str`/:class:`bytes`, or a file-like object.
|
| :param fields:
| Data to encode and send in the URL or request body, depending on ``method``.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param json:
| Data to encode and send as JSON with UTF-encoded in the request body.
| The ``"Content-Type"`` header will be set to ``"application/json"``
| unless specified otherwise.
|
| request_encode_body(self, method: 'str', url: 'str', fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, encode_multipart: 'bool' = True, multipart_boundary: 'str | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the body. This is useful for request methods like POST, PUT, PATCH, etc.
|
| When ``encode_multipart=True`` (default), then
| :func:`urllib3.encode_multipart_formdata` is used to encode
| the payload with the appropriate content type. Otherwise
| :func:`urllib.parse.urlencode` is used with the
| 'application/x-www-form-urlencoded' content type.
|
| Multipart encoding must be used when posting files, and it's reasonably
| safe to use it in other times too. However, it may break request
| signing, such as with OAuth.
|
| Supports an optional ``fields`` parameter of key/value strings AND
| key/filetuple. A filetuple is a (filename, data, MIME type) tuple where
| the MIME type is optional. For example::
|
| fields = {
| 'foo': 'bar',
| 'fakefile': ('foofile.txt', 'contents of foofile'),
| 'realfile': ('barfile.txt', open('realfile').read()),
| 'typedfile': ('bazfile.bin', open('bazfile').read(),
| 'image/jpeg'),
| 'nonamefile': 'contents of nonamefile field',
| }
|
| When uploading a file, providing a filename (the first parameter of the
| tuple) is optional but recommended to best mimic behavior of browsers.
|
| Note that if ``headers`` are supplied, the 'Content-Type' header will
| be overwritten because it depends on the dynamic random boundary string
| which is used to compose the body of the request. The random boundary
| string can be explicitly set with the ``multipart_boundary`` parameter.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the request body.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| :param encode_multipart:
| If True, encode the ``fields`` using the multipart/form-data MIME
| format.
|
| :param multipart_boundary:
| If not specified, then a random boundary will be generated using
| :func:`urllib3.filepost.choose_boundary`.
|
| request_encode_url(self, method: 'str', url: 'str', fields: '_TYPE_ENCODE_URL_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, **urlopen_kw: 'str') -> 'BaseHTTPResponse'
| Make a request using :meth:`urlopen` with the ``fields`` encoded in
| the url. This is useful for request methods like GET, HEAD, DELETE, etc.
|
| :param method:
| HTTP request method (such as GET, POST, PUT, etc.)
|
| :param url:
| The URL to perform the request on.
|
| :param fields:
| Data to encode and send in the URL.
|
| :param headers:
| Dictionary of custom headers to send, such as User-Agent,
| If-None-Match, etc. If None, pool headers are used. If provided,
| these headers completely replace any pool-specific headers.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from urllib3._request_methods.RequestMethods:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Retry(builtins.object)
| Retry(total: 'bool | int | None' = 10, connect: 'int | None' = None, read: 'int | None' = None, redirect: 'bool | int | None' = None, status: 'int | None' = None, other: 'int | None' = None, allowed_methods: 'typing.Collection[str] | None' = frozenset({'GET', 'DELETE', 'PUT', 'TRACE', 'OPTIONS', 'HEAD'}), status_forcelist: 'typing.Collection[int] | None' = None, backoff_factor: 'float' = 0, backoff_max: 'float' = 120, raise_on_redirect: 'bool' = True, raise_on_status: 'bool' = True, history: 'tuple[RequestHistory, ...] | None' = None, respect_retry_after_header: 'bool' = True, remove_headers_on_redirect: 'typing.Collection[str]' = frozenset({'Cookie', 'Authorization', 'Proxy-Authorization'}), backoff_jitter: 'float' = 0.0, retry_after_max: 'int' = 21600) -> 'None'
|
| Retry configuration.
|
| Each retry attempt will create a new Retry object with updated values, so
| they can be safely reused.
|
| Retries can be defined as a default for a pool:
|
| .. code-block:: python
|
| retries = Retry(connect=5, read=2, redirect=5)
| http = PoolManager(retries=retries)
| response = http.request("GET", "https://example.com/")
|
| Or per-request (which overrides the default for the pool):
|
| .. code-block:: python
|
| response = http.request("GET", "https://example.com/", retries=Retry(10))
|
| Retries can be disabled by passing ``False``:
|
| .. code-block:: python
|
| response = http.request("GET", "https://example.com/", retries=False)
|
| Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless
| retries are disabled, in which case the causing exception will be raised.
|
| :param int total:
| Total number of retries to allow. Takes precedence over other counts.
|
| Set to ``None`` to remove this constraint and fall back on other
| counts.
|
| Set to ``0`` to fail on the first retry.
|
| Set to ``False`` to disable and imply ``raise_on_redirect=False``.
|
| :param int connect:
| How many connection-related errors to retry on.
|
| These are errors raised before the request is sent to the remote server,
| which we assume has not triggered the server to process the request.
|
| Set to ``0`` to fail on the first retry of this type.
|
| :param int read:
| How many times to retry on read errors.
|
| These errors are raised after the request was sent to the server, so the
| request may have side-effects.
|
| Set to ``0`` to fail on the first retry of this type.
|
| :param int redirect:
| How many redirects to perform. Limit this to avoid infinite redirect
| loops.
|
| A redirect is a HTTP response with a status code 301, 302, 303, 307 or
| 308.
|
| Set to ``0`` to fail on the first retry of this type.
|
| Set to ``False`` to disable and imply ``raise_on_redirect=False``.
|
| :param int status:
| How many times to retry on bad status codes.
|
| These are retries made on responses, where status code matches
| ``status_forcelist``.
|
| Set to ``0`` to fail on the first retry of this type.
|
| :param int other:
| How many times to retry on other errors.
|
| Other errors are errors that are not connect, read, redirect or status errors.
| These errors might be raised after the request was sent to the server, so the
| request might have side-effects.
|
| Set to ``0`` to fail on the first retry of this type.
|
| If ``total`` is not set, it's a good idea to set this to 0 to account
| for unexpected edge cases and avoid infinite retry loops.
|
| :param Collection allowed_methods:
| Set of uppercased HTTP method verbs that we should retry on.
|
| By default, we only retry on methods which are considered to be
| idempotent (multiple requests with the same parameters end with the
| same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`.
|
| Set to a ``None`` value to retry on any verb.
|
| :param Collection status_forcelist:
| A set of integer HTTP status codes that we should force a retry on.
| A retry is initiated if the request method is in ``allowed_methods``
| and the response status code is in ``status_forcelist``.
|
| By default, this is disabled with ``None``.
|
| :param float backoff_factor:
| A backoff factor to apply between attempts after the second try
| (most errors are resolved immediately by a second try without a
| delay). urllib3 will sleep for::
|
| {backoff factor} * (2 ** ({number of previous retries}))
|
| seconds. If `backoff_jitter` is non-zero, this sleep is extended by::
|
| random.uniform(0, {backoff jitter})
|
| seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will
| sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever
| be longer than `backoff_max`.
|
| By default, backoff is disabled (factor set to 0).
|
| :param float backoff_max:
| The maximum backoff time (in seconds) between retry attempts.
| This value caps the computed backoff from `backoff_factor`.
|
| :param float backoff_jitter:
| Random jitter amount (in seconds) added to the computed backoff.
| Jitter is sampled uniformly from `0` to `backoff_jitter`.
|
| :param bool raise_on_redirect: Whether, if the number of redirects is
| exhausted, to raise a MaxRetryError, or to return a response with a
| response code in the 3xx range.
|
| :param bool raise_on_status: Similar meaning to ``raise_on_redirect``:
| whether we should raise an exception, or return a response,
| if status falls in ``status_forcelist`` range and retries have
| been exhausted.
|
| :param tuple history: The history of the request encountered during
| each call to :meth:`~Retry.increment`. The list is in the order
| the requests occurred. Each list item is of class :class:`RequestHistory`.
|
| :param bool respect_retry_after_header:
| Whether to respect Retry-After header on status codes defined as
| :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not.
|
| :param Collection remove_headers_on_redirect:
| Sequence of headers to remove from the request when a response
| indicating a redirect is returned before firing off the redirected
| request.
|
| :param int retry_after_max: Number of seconds to allow as the maximum for
| Retry-After headers. Defaults to :attr:`Retry.DEFAULT_RETRY_AFTER_MAX`.
| Any Retry-After headers larger than this value will be limited to this
| value.
|
| Methods defined here:
|
| __init__(self, total: 'bool | int | None' = 10, connect: 'int | None' = None, read: 'int | None' = None, redirect: 'bool | int | None' = None, status: 'int | None' = None, other: 'int | None' = None, allowed_methods: 'typing.Collection[str] | None' = frozenset({'GET', 'DELETE', 'PUT', 'TRACE', 'OPTIONS', 'HEAD'}), status_forcelist: 'typing.Collection[int] | None' = None, backoff_factor: 'float' = 0, backoff_max: 'float' = 120, raise_on_redirect: 'bool' = True, raise_on_status: 'bool' = True, history: 'tuple[RequestHistory, ...] | None' = None, respect_retry_after_header: 'bool' = True, remove_headers_on_redirect: 'typing.Collection[str]' = frozenset({'Cookie', 'Authorization', 'Proxy-Authorization'}), backoff_jitter: 'float' = 0.0, retry_after_max: 'int' = 21600) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| get_backoff_time(self) -> 'float'
| Formula for computing the current backoff
|
| :rtype: float
|
| get_retry_after(self, response: 'BaseHTTPResponse') -> 'float | None'
| Get the value of Retry-After in seconds.
|
| increment(self, method: 'str | None' = None, url: 'str | None' = None, response: 'BaseHTTPResponse | None' = None, error: 'Exception | None' = None, _pool: 'ConnectionPool | None' = None, _stacktrace: 'TracebackType | None' = None) -> 'Self'
| Return a new Retry object with incremented retry counters.
|
| :param response: A response object, or None, if the server did not
| return a response.
| :type response: :class:`~urllib3.response.BaseHTTPResponse`
| :param Exception error: An error encountered during the request, or
| None if the response was received successfully.
|
| :return: A new ``Retry`` object.
|
| is_exhausted(self) -> 'bool'
| Are we out of retries?
|
| is_retry(self, method: 'str', status_code: 'int', has_retry_after: 'bool' = False) -> 'bool'
| Is this method/status code retryable? (Based on allowlists and control
| variables such as the number of total retries to allow, whether to
| respect the Retry-After header, whether this header is present, and
| whether the returned status code is on the list of status codes to
| be retried upon on the presence of the aforementioned header)
|
| new(self, **kw: 'typing.Any') -> 'Self'
|
| parse_retry_after(self, retry_after: 'str') -> 'float'
|
| sleep(self, response: 'BaseHTTPResponse | None' = None) -> 'None'
| Sleep between retry attempts.
|
| This method will respect a server's ``Retry-After`` response header
| and sleep the duration of the time requested. If that is not present, it
| will use an exponential backoff. By default, the backoff factor is 0 and
| this method will return immediately.
|
| sleep_for_retry(self, response: 'BaseHTTPResponse') -> 'bool'
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_int(retries: 'Retry | bool | int | None', redirect: 'bool | int | None' = True, default: 'Retry | bool | int | None' = None) -> 'Retry'
| Backwards-compatibility for the old retries format.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DEFAULT = Retry(total=3, connect=None, read=None, redirect=None, statu...
|
| DEFAULT_ALLOWED_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS...
|
| DEFAULT_BACKOFF_MAX = 120
|
| DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset({'Authorization', 'Cook...
|
| DEFAULT_RETRY_AFTER_MAX = 21600
|
| RETRY_AFTER_STATUS_CODES = frozenset({413, 429, 503})
|
| __annotations__ = {'DEFAULT': 'typing.ClassVar[Retry]', 'DEFAULT_RETRY...
class Timeout(builtins.object)
| Timeout(total: '_TYPE_TIMEOUT' = None, connect: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>, read: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>) -> 'None'
|
| Timeout configuration.
|
| Timeouts can be defined as a default for a pool:
|
| .. code-block:: python
|
| import urllib3
|
| timeout = urllib3.util.Timeout(connect=2.0, read=7.0)
|
| http = urllib3.PoolManager(timeout=timeout)
|
| resp = http.request("GET", "https://example.com/")
|
| print(resp.status)
|
| Or per-request (which overrides the default for the pool):
|
| .. code-block:: python
|
| response = http.request("GET", "https://example.com/", timeout=Timeout(10))
|
| Timeouts can be disabled by setting all the parameters to ``None``:
|
| .. code-block:: python
|
| no_timeout = Timeout(connect=None, read=None)
| response = http.request("GET", "https://example.com/", timeout=no_timeout)
|
|
| :param total:
| This combines the connect and read timeouts into one; the read timeout
| will be set to the time leftover from the connect attempt. In the
| event that both a connect timeout and a total are specified, or a read
| timeout and a total are specified, the shorter timeout will be applied.
|
| Defaults to None.
|
| :type total: int, float, or None
|
| :param connect:
| The maximum amount of time (in seconds) to wait for a connection
| attempt to a server to succeed. Omitting the parameter will default the
| connect timeout to the system default, probably `the global default
| timeout in socket.py
| <http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_.
| None will set an infinite timeout for connection attempts.
|
| :type connect: int, float, or None
|
| :param read:
| The maximum amount of time (in seconds) to wait between consecutive
| read operations for a response from the server. Omitting the parameter
| will default the read timeout to the system default, probably `the
| global default timeout in socket.py
| <http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_.
| None will set an infinite timeout.
|
| :type read: int, float, or None
|
| .. note::
|
| Many factors can affect the total amount of time for urllib3 to return
| an HTTP response.
|
| For example, Python's DNS resolver does not obey the timeout specified
| on the socket. Other factors that can affect total request time include
| high CPU load, high swap, the program running at a low priority level,
| or other behaviors.
|
| In addition, the read and total timeouts only measure the time between
| read operations on the socket connecting the client and the server,
| not the total amount of time for the request to return a complete
| response. For most requests, the timeout is raised because the server
| has not sent the first byte in the specified time. This is not always
| the case; if a server streams one byte every fifteen seconds, a timeout
| of 20 seconds will not trigger, even though the request will take
| several minutes to complete.
|
| Methods defined here:
|
| __init__(self, total: '_TYPE_TIMEOUT' = None, connect: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>, read: '_TYPE_TIMEOUT' = <_TYPE_DEFAULT.token: -1>) -> 'None'
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self) -> 'str'
| Return repr(self).
|
| __str__ = __repr__(self) -> 'str'
|
| clone(self) -> 'Timeout'
| Create a copy of the timeout object
|
| Timeout properties are stored per-pool but each request needs a fresh
| Timeout object to ensure each one has its own start/stop configured.
|
| :return: a copy of the timeout object
| :rtype: :class:`Timeout`
|
| get_connect_duration(self) -> 'float'
| Gets the time elapsed since the call to :meth:`start_connect`.
|
| :return: Elapsed time in seconds.
| :rtype: float
| :raises urllib3.exceptions.TimeoutStateError: if you attempt
| to get duration for a timer that hasn't been started.
|
| start_connect(self) -> 'float'
| Start the timeout clock, used during a connect() attempt
|
| :raises urllib3.exceptions.TimeoutStateError: if you attempt
| to start a timer that has been started already.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| from_float(timeout: '_TYPE_TIMEOUT') -> 'Timeout'
| Create a new Timeout from a legacy timeout value.
|
| The timeout value used by httplib.py sets the same timeout on the
| connect(), and recv() socket requests. This creates a :class:`Timeout`
| object that sets the individual timeouts to the ``timeout`` value
| passed to this function.
|
| :param timeout: The legacy timeout value.
| :type timeout: integer, float, :attr:`urllib3.util.Timeout.DEFAULT_TIMEOUT`, or None
| :return: Timeout object
| :rtype: :class:`Timeout`
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| resolve_default_timeout(timeout: '_TYPE_TIMEOUT') -> 'float | None'
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| connect_timeout
| Get the value to use when setting a connection timeout.
|
| This will be a positive float or integer, the value None
| (never timeout), or the default system timeout.
|
| :return: Connect timeout.
| :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
|
| read_timeout
| Get the value for the read timeout.
|
| This assumes some time has elapsed in the connection timeout and
| computes the read timeout appropriately.
|
| If self.total is set, the read timeout is dependent on the amount of
| time taken by the connect timeout. If the connection time has not been
| established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be
| raised.
|
| :return: Value to use for the read timeout.
| :rtype: int, float or None
| :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect`
| has not yet been called on this object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| DEFAULT_TIMEOUT = <_TYPE_DEFAULT.token: -1>
|
| __annotations__ = {'DEFAULT_TIMEOUT': '_TYPE_TIMEOUT'}
FUNCTIONS
add_stderr_logger(level: 'int' = 10) -> 'logging.StreamHandler[typing.TextIO]'
Helper for quickly adding a StreamHandler to the logger. Useful for
debugging.
Returns the handler after adding it.
connection_from_url(url: 'str', **kw: 'typing.Any') -> 'HTTPConnectionPool'
Given a url, return an :class:`.ConnectionPool` instance of its host.
This is a shortcut for not having to parse out the scheme, host, and port
of the url before creating an :class:`.ConnectionPool` instance.
:param url:
Absolute URL string that must include the scheme. Port is optional.
:param \**kw:
Passes additional parameters to the constructor of the appropriate
:class:`.ConnectionPool`. Useful for specifying things like
timeout, maxsize, headers, etc.
Example::
>>> conn = connection_from_url('http://google.com/')
>>> r = conn.request('GET', '/')
disable_warnings(category: 'type[Warning]' = <class 'urllib3.exceptions.HTTPWarning'>) -> 'None'
Helper for quickly disabling all urllib3 warnings.
encode_multipart_formdata(fields: '_TYPE_FIELDS', boundary: 'str | None' = None) -> 'tuple[bytes, str]'
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
Values are processed by :func:`urllib3.fields.RequestField.from_tuples`.
:param boundary:
If not specified, then a random boundary will be generated using
:func:`urllib3.filepost.choose_boundary`.
make_headers(keep_alive: 'bool | None' = None, accept_encoding: 'bool | list[str] | str | None' = None, user_agent: 'str | None' = None, basic_auth: 'str | None' = None, proxy_basic_auth: 'str | None' = None, disable_cache: 'bool | None' = None) -> 'dict[str, str]'
Shortcuts for generating request headers.
:param keep_alive:
If ``True``, adds 'connection: keep-alive' header.
:param accept_encoding:
Can be a boolean, list, or string.
``True`` translates to 'gzip,deflate'. If the dependencies for
Brotli (either the ``brotli`` or ``brotlicffi`` package) and/or
Zstandard (the ``backports.zstd`` package for Python before 3.14)
algorithms are installed, then their encodings are
included in the string ('br' and 'zstd', respectively).
List will get joined by comma.
String will be used as provided.
:param user_agent:
String representing the user-agent you want, such as
"python-urllib3/0.6"
:param basic_auth:
Colon-separated username:password string for 'authorization: basic ...'
auth header.
:param proxy_basic_auth:
Colon-separated username:password string for 'proxy-authorization: basic ...'
auth header.
:param disable_cache:
If ``True``, adds 'cache-control: no-cache' header.
Example:
.. code-block:: python
import urllib3
print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0"))
# {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
print(urllib3.util.make_headers(accept_encoding=True))
# {'accept-encoding': 'gzip,deflate'}
proxy_from_url(url: 'str', **kw: 'typing.Any') -> 'ProxyManager'
request(method: 'str', url: 'str', *, body: '_TYPE_BODY | None' = None, fields: '_TYPE_FIELDS | None' = None, headers: 'typing.Mapping[str, str] | None' = None, preload_content: 'bool | None' = True, decode_content: 'bool | None' = True, redirect: 'bool | None' = True, retries: 'Retry | bool | int | None' = None, timeout: 'Timeout | float | int | None' = 3, json: 'typing.Any | None' = None) -> 'BaseHTTPResponse'
A convenience, top-level request method. It uses a module-global ``PoolManager`` instance.
Therefore, its side effects could be shared across dependencies relying on it.
To avoid side effects create a new ``PoolManager`` instance and use it instead.
The method does not accept low-level ``**urlopen_kw`` keyword arguments.
:param method:
HTTP request method (such as GET, POST, PUT, etc.)
:param url:
The URL to perform the request on.
:param body:
Data to send in the request body, either :class:`str`, :class:`bytes`,
an iterable of :class:`str`/:class:`bytes`, or a file-like object.
:param fields:
Data to encode and send in the request body.
:param headers:
Dictionary of custom headers to send, such as User-Agent,
If-None-Match, etc.
:param bool preload_content:
If True, the response's body will be preloaded into memory.
:param bool decode_content:
If True, will attempt to decode the body based on the
'content-encoding' header.
:param redirect:
If True, automatically handle redirects (status codes 301, 302,
303, 307, 308). Each redirect counts as a retry. Disabling retries
will disable redirect, too.
:param retries:
Configure the number of retries to allow before raising a
:class:`~urllib3.exceptions.MaxRetryError` exception.
If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a
:class:`~urllib3.util.retry.Retry` object for fine-grained control
over different types of retries.
Pass an integer number to retry connection errors that many times,
but no other types of errors. Pass zero to never retry.
If ``False``, then retries are disabled and any exception is raised
immediately. Also, instead of raising a MaxRetryError on redirects,
the redirect response will be returned.
:type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
:param timeout:
If specified, overrides the default timeout for this one
request. It may be a float (in seconds) or an instance of
:class:`urllib3.util.Timeout`.
:param json:
Data to encode and send as JSON with UTF-encoded in the request body.
The ``"Content-Type"`` header will be set to ``"application/json"``
unless specified otherwise.
DATA
__all__ = ('HTTPConnectionPool', 'HTTPHeaderDict', 'HTTPSConnectionPoo...
__license__ = 'MIT'
VERSION
2.7.0
AUTHOR
Andrey Petrov (andrey.petrov@shazow.net)
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\urllib3\__init__.py
requests.utils
Python Library Documentation: module requests.utils in requests
NAME
requests.utils
DESCRIPTION
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
FUNCTIONS
add_dict_to_cookiejar(cj: 'CookieJar', cookie_dict: 'dict[str, str]') -> 'CookieJar'
Returns a CookieJar from a key/value dictionary.
:param cj: CookieJar to insert cookies into.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:rtype: CookieJar
address_in_network(ip: 'str', net: 'str') -> 'bool'
This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool
atomic_open(filename: 'str') -> 'Generator[BufferedWriter, None, None]'
Write a file to the disk in an atomic fashion
check_header_validity(header: 'tuple[str | bytes, str | bytes]') -> 'None'
Verifies that header parts don't contain leading whitespace
reserved characters, or return characters.
:param header: tuple, in the format (name, value).
default_headers() -> 'CaseInsensitiveDict[str]'
:rtype: requests.structures.CaseInsensitiveDict
default_user_agent(name: 'str' = 'python-requests') -> 'str'
Return a string representing the default user agent.
:rtype: str
dict_from_cookiejar(cj: 'CookieJar') -> 'dict[str, str | None]'
Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict
dict_to_sequence(d: '_t.SupportsItems[Any, Any] | Iterable[tuple[Any, Any]]') -> 'Iterable[tuple[Any, Any]]'
Returns an internal sequence dictionary update.
dotted_netmask(mask: 'int') -> 'str'
Converts mask from /xx format to xxx.xxx.xxx.xxx
Example: if mask is 24 function returns 255.255.255.0
:rtype: str
extract_zipped_paths(path: 'str') -> 'str'
Replace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
from_key_val_list(value: 'Mapping[Any, Any] | Iterable[tuple[Any, Any]] | None') -> 'dict[Any, Any] | None'
Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('string')
Traceback (most recent call last):
...
ValueError: cannot encode objects that are not 2-tuples
>>> from_key_val_list({'key': 'val'})
OrderedDict([('key', 'val')])
:rtype: OrderedDict
get_auth_from_url(url: 'str') -> 'tuple[str, str]'
Given a url with authentication components, extract them into a tuple of
username,password.
:rtype: (str,str)
get_encoding_from_headers(headers: 'CaseInsensitiveDict[str]') -> 'str | None'
Returns encodings from given HTTP Header Dict.
:param headers: dictionary to extract encoding from.
:rtype: str
get_encodings_from_content(content: 'str') -> 'list[str]'
Returns encodings from given content string.
:param content: bytestring to extract encodings from.
get_environ_proxies(url: 'str', no_proxy: 'str | None' = None) -> 'dict[str, str]'
Return a dict of environment proxies.
:rtype: dict
get_netrc_auth(url: '_t.UriType', raise_errors: 'bool' = False) -> 'tuple[str, str] | None'
Returns the Requests tuple auth for a given url from netrc.
get_unicode_from_response(r: 'Response') -> 'str | bytes | None'
Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
:rtype: str
guess_filename(obj: 'Any') -> 'str | None'
Tries to guess the filename of the given object.
guess_json_utf(data: 'bytes') -> 'str | None'
:rtype: str
is_ipv4_address(string_ip: 'str') -> 'bool'
:rtype: bool
is_valid_cidr(string_network: 'str') -> 'bool'
Very simple check of the cidr format in no_proxy variable.
:rtype: bool
iter_slices(string: 'bytes | str', slice_length: 'int | None') -> 'Generator[bytes | str, None, None]'
Iterate over slices of a string.
parse_dict_header(value: 'str') -> 'dict[str, str | None]'
Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
If there is no value for a key it will be `None`:
>>> parse_dict_header('key_without_value')
{'key_without_value': None}
To create a header from the :class:`dict` again, use the
:func:`dump_header` function.
:param value: a string with a dict header.
:return: :class:`dict`
:rtype: dict
parse_header_links(value: 'str') -> 'list[dict[str, str]]'
Return a list of parsed link headers proxies.
i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"
:rtype: list
parse_list_header(value: 'str') -> 'list[str]'
Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed automatically after parsing.
It basically works like :func:`parse_set_header` just that items
may appear multiple times and case sensitivity is preserved.
The return value is a standard :class:`list`:
>>> parse_list_header('token, "quoted value"')
['token', 'quoted value']
To create a header from the :class:`list` again, use the
:func:`dump_header` function.
:param value: a string with a list header.
:return: :class:`list`
:rtype: list
prepend_scheme_if_needed(url: 'str', new_scheme: 'str') -> 'str'
Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str
proxy_bypass(host: 'str') -> 'bool'
Return True, if the host should be bypassed.
Checks proxy settings gathered from the environment, if specified,
or the registry.
proxy_bypass_registry(host: 'str') -> 'bool'
requote_uri(uri: 'str') -> 'str'
Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str
resolve_proxies(request: 'Request | PreparedRequest', proxies: 'dict[str, str] | None', trust_env: 'bool' = True) -> 'dict[str, str]'
This method takes proxy information from a request and configuration
input to resolve a mapping of target proxies. This will consider settings
such as NO_PROXY to strip proxy configurations.
:param request: Request or PreparedRequest
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
:param trust_env: Boolean declaring whether to trust environment configs
:rtype: dict
rewind_body(prepared_request: 'PreparedRequest') -> 'None'
Move file pointer back to its recorded starting position
so it can be read again on redirect.
select_proxy(url: 'str', proxies: 'dict[str, str] | None') -> 'str | None'
Select a proxy for the url, if applicable.
:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
set_environ(env_name: 'str', value: 'str | None') -> 'Generator[None, None, None]'
Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing
should_bypass_proxies(url: 'str', no_proxy: 'str | None') -> 'bool'
Returns whether we should bypass proxies or not.
:rtype: bool
stream_decode_response_unicode(iterator: 'Iterable[bytes]', r: 'Response') -> 'Generator[str | bytes, None, None]'
Stream decodes an iterator.
super_len(o: 'Any') -> 'int'
to_key_val_list(value: '_t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]] | None') -> 'list[tuple[_KT, _VT]] | None'
Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to_key_val_list('string')
Traceback (most recent call last):
...
ValueError: cannot encode objects that are not 2-tuples
:rtype: list
unquote_header_value(value: 'str', is_filename: 'bool' = False) -> 'str'
Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str
unquote_unreserved(uri: 'str') -> 'str'
Un-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.
:rtype: str
urldefragauth(url: 'str') -> 'str'
Given a url remove the fragment and the authentication part.
:rtype: str
DATA
DEFAULT_ACCEPT_ENCODING = 'gzip, deflate'
DEFAULT_CA_BUNDLE_PATH = r'C:\Users\Youse\AppData\Local\Programs\Pytho...
DEFAULT_PORTS = {'http': 80, 'https': 443}
Final = typing.Final
Special typing construct to indicate final names to type checkers.
A final name cannot be re-assigned or overridden in a subclass.
For example::
MAX_SIZE: Final = 9000
MAX_SIZE += 1 # Error reported by type checker
class Connection:
TIMEOUT: Final[int] = 10
class FastConnector(Connection):
TIMEOUT = 1 # Error reported by type checker
There is no runtime checking of these properties.
HEADER_VALIDATORS = {<class 'bytes'>: (re.compile(b'^[^:\\s][^:\\r\\n]...
NETRC_FILES = ('.netrc', '_netrc')
TYPE_CHECKING = False
UNRESERVED_SET = frozenset({'-', '.', '0', '1', '2', '3', ...})
__annotations__ = {'DEFAULT_ACCEPT_ENCODING': 'Final', 'DEFAULT_CA_BUN...
integer_types = (<class 'int'>,)
is_urllib3_1 = False
VERSION
2.34.2
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\requests\utils.py
requests.warnings
Python Library Documentation: module warnings
NAME
warnings - Python part of the warnings subsystem.
MODULE REFERENCE
https://docs.python.org/3.12/library/warnings.html
The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.
CLASSES
builtins.object
catch_warnings
class catch_warnings(builtins.object)
| catch_warnings(*, record=False, module=None, action=None, category=<class 'Warning'>, lineno=0, append=False)
|
| A context manager that copies and restores the warnings filter upon
| exiting the context.
|
| The 'record' argument specifies whether warnings should be captured by a
| custom implementation of warnings.showwarning() and be appended to a list
| returned by the context manager. Otherwise None is returned by the context
| manager. The objects appended to the list are arguments whose attributes
| mirror the arguments to showwarning().
|
| The 'module' argument is to specify an alternative module to the module
| named 'warnings' and imported under that name. This argument is only useful
| when testing the warnings module itself.
|
| If the 'action' argument is not None, the remaining arguments are passed
| to warnings.simplefilter() as if it were called immediately on entering the
| context.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *exc_info)
|
| __init__(self, *, record=False, module=None, action=None, category=<class 'Warning'>, lineno=0, append=False)
| Specify whether to record warnings and if an alternative module
| should be used other than sys.modules['warnings'].
|
| For compatibility with Python 3.0, please consider all arguments to be
| keyword-only.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
filterwarnings(action, message='', category=<class 'Warning'>, module='', lineno=0, append=False)
Insert an entry into the list of warnings filters (at the front).
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'message' -- a regex that the warning message must match
'category' -- a class that the warning must be a subclass of
'module' -- a regex that the module name must match
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
formatwarning(message, category, filename, lineno, line=None)
Function to format a warning the standard way.
resetwarnings()
Clear the list of warning filters, so that no filters are active.
showwarning(message, category, filename, lineno, file=None, line=None)
Hook to write a warning to a file; replace if you like.
simplefilter(action, category=<class 'Warning'>, lineno=0, append=False)
Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a class that the warning must be a subclass of
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
warn_explicit(...)
Issue a warning, or maybe ignore it or raise an exception.
DATA
__all__ = ['warn', 'warn_explicit', 'showwarning', 'formatwarning', 'f...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\warnings.py