urllib API Reference
Full documentation for urllib (Standard Library / Native)
urllib.error
Python Library Documentation: module urllib.error in urllib
NAME
urllib.error - Exception classes raised by urllib.
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.error.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
The base exception class is URLError, which inherits from OSError. It
doesn't define any behavior of its own, but is the base class for all
exceptions defined in this package.
HTTPError is an exception class that is also a valid HTTP response
instance. It behaves this way because HTTP protocol errors are valid
responses, with a status code, headers, and a body. In some contexts,
an application may want to handle an exception like a regular
response.
CLASSES
builtins.OSError(builtins.Exception)
URLError
ContentTooShortError
HTTPError(URLError, urllib.response.addinfourl)
class ContentTooShortError(URLError)
| ContentTooShortError(message, content)
|
| Exception raised when downloaded size does not match content-length.
|
| Method resolution order:
| ContentTooShortError
| URLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, message, content)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from URLError:
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from URLError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __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 HTTPError(URLError, urllib.response.addinfourl)
| HTTPError(url, code, msg, hdrs, fp)
|
| Raised when HTTP error occurs, but also acts like non-error return
|
| Method resolution order:
| HTTPError
| URLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| urllib.response.addinfourl
| urllib.response.addinfo
| urllib.response.addbase
| tempfile._TemporaryFileWrapper
| builtins.object
|
| Methods defined here:
|
| __init__(self, url, code, msg, hdrs, fp)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| reason
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| headers
|
| ----------------------------------------------------------------------
| Data descriptors inherited from URLError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __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).
|
| __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
|
| ----------------------------------------------------------------------
| Methods inherited from urllib.response.addinfourl:
|
| getcode(self)
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from urllib.response.addinfourl:
|
| status
|
| ----------------------------------------------------------------------
| Methods inherited from urllib.response.addinfo:
|
| info(self)
|
| ----------------------------------------------------------------------
| Methods inherited from urllib.response.addbase:
|
| __enter__(self)
|
| __exit__(self, type, value, traceback)
|
| ----------------------------------------------------------------------
| Methods inherited from tempfile._TemporaryFileWrapper:
|
| __getattr__(self, name)
|
| __iter__(self)
| # iter() doesn't use __getattr__ to find the __iter__ method
|
| close(self)
| Close the temporary file, possibly deleting it.
class URLError(builtins.OSError)
| URLError(reason, filename=None)
|
| Method resolution order:
| URLError
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, reason, filename=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __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
DATA
__all__ = ['URLError', 'HTTPError', 'ContentTooShortError']
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\error.py
urllib.parse
Python Library Documentation: module urllib.parse in urllib
NAME
urllib.parse - Parse (absolute and relative) URLs.
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.parse.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
urlparse module is based upon the following RFC specifications.
RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
and L. Masinter, January 2005.
RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
and L.Masinter, December 1999.
RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T.
Berners-Lee, R. Fielding, and L. Masinter, August 1998.
RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998.
RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
1995.
RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
McCahill, December 1994
RFC 3986 is considered the current standard and any future changes to
urlparse module should conform with it. The urlparse module is
currently not entirely compliant with this RFC due to defacto
scenarios for parsing, and for backward compatibility purposes, some
parsing quirks from older RFCs are retained. The testcases in
test_urlparse.py provides a good indicator of parsing behavior.
The WHATWG URL Parser spec should also be considered. We are not compliant with
it either due to existing user code API behavior expectations (Hyrum's Law).
It serves as a useful guide when making changes.
CLASSES
DefragResult(builtins.tuple)
DefragResult(DefragResult, _ResultMixinStr)
DefragResultBytes(DefragResult, _ResultMixinBytes)
ParseResult(builtins.tuple)
ParseResult(ParseResult, _NetlocResultMixinStr)
ParseResultBytes(ParseResult, _NetlocResultMixinBytes)
SplitResult(builtins.tuple)
SplitResult(SplitResult, _NetlocResultMixinStr)
SplitResultBytes(SplitResult, _NetlocResultMixinBytes)
_NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes)
ParseResultBytes(ParseResult, _NetlocResultMixinBytes)
SplitResultBytes(SplitResult, _NetlocResultMixinBytes)
_NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr)
ParseResult(ParseResult, _NetlocResultMixinStr)
SplitResult(SplitResult, _NetlocResultMixinStr)
_ResultMixinBytes(builtins.object)
DefragResultBytes(DefragResult, _ResultMixinBytes)
_ResultMixinStr(builtins.object)
DefragResult(DefragResult, _ResultMixinStr)
class DefragResult(DefragResult, _ResultMixinStr)
| DefragResult(url, fragment)
|
| # Structured result objects for string data
|
| Method resolution order:
| DefragResult
| DefragResult
| builtins.tuple
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.DefragResultBytes'>
| # Structured result objects for bytes data
|
|
| ----------------------------------------------------------------------
| Methods inherited from DefragResult:
|
| __getnewargs__(self) from collections.DefragResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.DefragResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.DefragResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.DefragResult
| Return a new DefragResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from DefragResult:
|
| _make(iterable) from collections.DefragResult
| Make a new DefragResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from DefragResult:
|
| __new__(_cls, url, fragment) from namedtuple_DefragResult.DefragResult
| Create new instance of DefragResult(url, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DefragResult:
|
| url
| The URL with no fragment identifier.
|
| fragment
| Fragment identifier separated from URL, that allows indirect identification of a
| secondary resource by reference to a primary resource and additional identifying
| information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DefragResult:
|
| __match_args__ = ('url', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('url', 'fragment')
|
| ----------------------------------------------------------------------
| 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 _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
class DefragResultBytes(DefragResult, _ResultMixinBytes)
| DefragResultBytes(url, fragment)
|
| # Structured result objects for bytes data
|
| Method resolution order:
| DefragResultBytes
| DefragResult
| builtins.tuple
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.DefragResult'>
| # Structured result objects for string data
|
|
| ----------------------------------------------------------------------
| Methods inherited from DefragResult:
|
| __getnewargs__(self) from collections.DefragResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.DefragResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.DefragResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.DefragResult
| Return a new DefragResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from DefragResult:
|
| _make(iterable) from collections.DefragResult
| Make a new DefragResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from DefragResult:
|
| __new__(_cls, url, fragment) from namedtuple_DefragResult.DefragResult
| Create new instance of DefragResult(url, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DefragResult:
|
| url
| The URL with no fragment identifier.
|
| fragment
| Fragment identifier separated from URL, that allows indirect identification of a
| secondary resource by reference to a primary resource and additional identifying
| information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DefragResult:
|
| __match_args__ = ('url', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('url', 'fragment')
|
| ----------------------------------------------------------------------
| 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 _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
class ParseResult(ParseResult, _NetlocResultMixinStr)
| ParseResult(scheme, netloc, path, params, query, fragment)
|
| Method resolution order:
| ParseResult
| ParseResult
| builtins.tuple
| _NetlocResultMixinStr
| _NetlocResultMixinBase
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.ParseResultBytes'>
|
| ----------------------------------------------------------------------
| Methods inherited from ParseResult:
|
| __getnewargs__(self) from collections.ParseResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.ParseResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.ParseResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.ParseResult
| Return a new ParseResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from ParseResult:
|
| _make(iterable) from collections.ParseResult
| Make a new ParseResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from ParseResult:
|
| __new__(_cls, scheme, netloc, path, params, query, fragment) from namedtuple_ParseResult.ParseResult
| Create new instance of ParseResult(scheme, netloc, path, params, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ParseResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| params
| Parameters for last path element used to dereference the URI in order to provide
| access to perform some operation on the resource.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ParseResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'params', 'query', 'frag...
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'params', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinStr:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
class ParseResultBytes(ParseResult, _NetlocResultMixinBytes)
| ParseResultBytes(scheme, netloc, path, params, query, fragment)
|
| Method resolution order:
| ParseResultBytes
| ParseResult
| builtins.tuple
| _NetlocResultMixinBytes
| _NetlocResultMixinBase
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.ParseResult'>
|
| ----------------------------------------------------------------------
| Methods inherited from ParseResult:
|
| __getnewargs__(self) from collections.ParseResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.ParseResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.ParseResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.ParseResult
| Return a new ParseResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from ParseResult:
|
| _make(iterable) from collections.ParseResult
| Make a new ParseResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from ParseResult:
|
| __new__(_cls, scheme, netloc, path, params, query, fragment) from namedtuple_ParseResult.ParseResult
| Create new instance of ParseResult(scheme, netloc, path, params, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ParseResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| params
| Parameters for last path element used to dereference the URI in order to provide
| access to perform some operation on the resource.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ParseResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'params', 'query', 'frag...
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'params', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBytes:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
class SplitResult(SplitResult, _NetlocResultMixinStr)
| SplitResult(scheme, netloc, path, query, fragment)
|
| Method resolution order:
| SplitResult
| SplitResult
| builtins.tuple
| _NetlocResultMixinStr
| _NetlocResultMixinBase
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.SplitResultBytes'>
|
| ----------------------------------------------------------------------
| Methods inherited from SplitResult:
|
| __getnewargs__(self) from collections.SplitResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.SplitResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.SplitResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.SplitResult
| Return a new SplitResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from SplitResult:
|
| _make(iterable) from collections.SplitResult
| Make a new SplitResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from SplitResult:
|
| __new__(_cls, scheme, netloc, path, query, fragment) from namedtuple_SplitResult.SplitResult
| Create new instance of SplitResult(scheme, netloc, path, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SplitResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from SplitResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinStr:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
class SplitResultBytes(SplitResult, _NetlocResultMixinBytes)
| SplitResultBytes(scheme, netloc, path, query, fragment)
|
| Method resolution order:
| SplitResultBytes
| SplitResult
| builtins.tuple
| _NetlocResultMixinBytes
| _NetlocResultMixinBase
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.SplitResult'>
|
| ----------------------------------------------------------------------
| Methods inherited from SplitResult:
|
| __getnewargs__(self) from collections.SplitResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.SplitResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.SplitResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.SplitResult
| Return a new SplitResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from SplitResult:
|
| _make(iterable) from collections.SplitResult
| Make a new SplitResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from SplitResult:
|
| __new__(_cls, scheme, netloc, path, query, fragment) from namedtuple_SplitResult.SplitResult
| Create new instance of SplitResult(scheme, netloc, path, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SplitResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from SplitResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBytes:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
FUNCTIONS
__getattr__(name)
parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Parse a query given as a string argument.
Arguments:
qs: percent-encoded query string to be parsed
keep_blank_values: flag indicating whether blank values in
percent-encoded queries should be treated as blank strings.
A true value indicates that blanks should be retained as
blank strings. The default false value indicates that
blank values are to be ignored and treated as if they were
not included.
strict_parsing: flag indicating what to do with parsing errors.
If false (the default), errors are silently ignored.
If true, errors raise a ValueError exception.
encoding and errors: specify how to decode percent-encoded sequences
into Unicode characters, as accepted by the bytes.decode() method.
max_num_fields: int. If set, then throws a ValueError if there
are more than n fields read by parse_qsl().
separator: str. The symbol to use for separating the query arguments.
Defaults to &.
Returns a dictionary.
parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Parse a query given as a string argument.
Arguments:
qs: percent-encoded query string to be parsed
keep_blank_values: flag indicating whether blank values in
percent-encoded queries should be treated as blank strings.
A true value indicates that blanks should be retained as blank
strings. The default false value indicates that blank values
are to be ignored and treated as if they were not included.
strict_parsing: flag indicating what to do with parsing errors. If
false (the default), errors are silently ignored. If true,
errors raise a ValueError exception.
encoding and errors: specify how to decode percent-encoded sequences
into Unicode characters, as accepted by the bytes.decode() method.
max_num_fields: int. If set, then throws a ValueError
if there are more than n fields read by parse_qsl().
separator: str. The symbol to use for separating the query arguments.
Defaults to &.
Returns a list, as G-d intended.
quote(string, safe='/', encoding=None, errors=None)
quote('abc def') -> 'abc%20def'
Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted. The
quote function offers a cautious (not minimal) way to quote a
string for most of these parts.
RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists
the following (un)reserved characters.
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Each of the reserved characters is reserved in some component of a URL,
but not necessarily in all of them.
The quote function %-escapes all characters that are neither in the
unreserved chars ("always safe") nor the additional chars set via the
safe arg.
The default for the safe arg is '/'. The character is reserved, but in
typical usage the quote function is being called on a path where the
existing slash characters are to be preserved.
Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings.
Now, "~" is included in the set of unreserved characters.
string and safe may be either str or bytes objects. encoding and errors
must not be specified if string is a bytes object.
The optional encoding and errors parameters specify how to deal with
non-ASCII characters, as accepted by the str.encode method.
By default, encoding='utf-8' (characters are encoded with UTF-8), and
errors='strict' (unsupported characters raise a UnicodeEncodeError).
quote_from_bytes(bs, safe='/')
Like quote(), but accepts a bytes object rather than a str, and does
not perform string-to-bytes encoding. It always returns an ASCII string.
quote_from_bytes(b'abc def?') -> 'abc%20def%3f'
quote_plus(string, safe='', encoding=None, errors=None)
Like quote(), but also replace ' ' with '+', as required for quoting
HTML form values. Plus signs in the original string are escaped unless
they are included in safe. It also does not have safe default to '/'.
unquote(string, encoding='utf-8', errors='replace')
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences into Unicode characters, as accepted by the bytes.decode()
method.
By default, percent-encoded sequences are decoded with UTF-8, and invalid
sequences are replaced by a placeholder character.
unquote('abc%20def') -> 'abc def'.
unquote_plus(string, encoding='utf-8', errors='replace')
Like unquote(), but also replace plus signs by spaces, as required for
unquoting HTML form values.
unquote_plus('%7e/abc+def') -> '~/abc def'
unquote_to_bytes(string)
unquote_to_bytes('abc%20def') -> b'abc def'.
urldefrag(url)
Removes any existing fragment from URL.
Returns a tuple of the defragmented URL and the fragment. If
the URL contained no fragments, the second element is the
empty string.
urlencode(query, doseq=False, safe='', encoding=None, errors=None, quote_via=<function quote_plus at 0x000001D7281EC220>)
Encode a dict or sequence of two-element tuples into a URL query string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the order of the
parameters in the output will match the order of parameters in the
input.
The components of a query arg may each be either a string or a bytes type.
The safe, encoding, and errors parameters are passed down to the function
specified by quote_via (encoding and errors only if a component is a str).
urljoin(base, url, allow_fragments=True)
Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
urlparse(url, scheme='', allow_fragments=True)
Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
The result is a named 6-tuple with fields corresponding to the
above. It is either a ParseResult or ParseResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urlsplit(url, scheme='', allow_fragments=True)
Parse a URL into 5 components:
<scheme>://<netloc>/<path>?<query>#<fragment>
The result is a named 5-tuple with fields corresponding to the
above. It is either a SplitResult or SplitResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urlunparse(components)
Put a parsed URL back together again. This may result in a
slightly different, but equivalent URL, if the URL that was parsed
originally had redundant delimiters, e.g. a ? with an empty query
(the draft states that these are equivalent).
urlunsplit(components)
Combine the elements of a tuple as returned by urlsplit() into a
complete URL as a string. The data argument can be any five-item iterable.
This may result in a slightly different, but equivalent URL, if the URL that
was parsed originally had unnecessary delimiters (for example, a ? with an
empty query; the RFC states that these are equivalent).
DATA
__all__ = ['urlparse', 'urlunparse', 'urljoin', 'urldefrag', 'urlsplit...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\parse.py
urllib.request
Python Library Documentation: module urllib.request in urllib
NAME
urllib.request - An extensible library for opening URLs using a variety of protocols
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.request.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
The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below). It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.
The OpenerDirector manages a collection of Handler objects that do
all the actual work. Each Handler implements a particular protocol or
option. The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL. For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns. The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303, 307, and 308 redirect errors, and the
HTTPDigestAuthHandler deals with digest authentication.
urlopen(url, data=None) -- Basic usage is the same as original
urllib. pass the url and optionally data to post to an HTTP URL, and
get a file-like object back. One difference is that you can also pass
a Request instance instead of URL. Raises a URLError (subclass of
OSError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.
build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers. Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate. If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.
install_opener -- Installs a new opener as the default opener.
objects of interest:
OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.
Request -- An object that encapsulates the state of a request. The
state can be as simple as the URL. It can also include extra HTTP
headers, e.g. a User-Agent.
BaseHandler --
internals:
BaseHandler and parent
_call_chain conventions
Example usage:
import urllib.request
# set up authentication info
authinfo = urllib.request.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
uri='https://mahler:8092/site-updates.py',
user='klem',
passwd='geheim$parole')
proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})
# build a new opener that adds authentication and caching FTP handlers
opener = urllib.request.build_opener(proxy_support, authinfo,
urllib.request.CacheFTPHandler)
# install it
urllib.request.install_opener(opener)
f = urllib.request.urlopen('https://www.python.org/')
CLASSES
builtins.object
AbstractBasicAuthHandler
HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
AbstractDigestAuthHandler
BaseHandler
DataHandler
FTPHandler
CacheFTPHandler
FileHandler
HTTPCookieProcessor
HTTPDefaultErrorHandler
HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler)
HTTPErrorProcessor
HTTPRedirectHandler
ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler)
ProxyHandler
UnknownHandler
HTTPPasswordMgr
HTTPPasswordMgrWithDefaultRealm
HTTPPasswordMgrWithPriorAuth
OpenerDirector
Request
URLopener
FancyURLopener
AbstractHTTPHandler(BaseHandler)
HTTPHandler
HTTPSHandler
class AbstractBasicAuthHandler(builtins.object)
| AbstractBasicAuthHandler(password_mgr=None)
|
| Methods defined here:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
class AbstractDigestAuthHandler(builtins.object)
| AbstractDigestAuthHandler(passwd=None)
|
| Methods defined here:
|
| __init__(self, passwd=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_algorithm_impls(self, algorithm)
|
| get_authorization(self, req, chal)
|
| get_cnonce(self, nonce)
|
| get_entity_digest(self, data, chal)
|
| http_error_auth_reqed(self, auth_header, host, req, headers)
|
| reset_retry_count(self)
|
| retry_http_digest_auth(self, req, auth)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class BaseHandler(builtins.object)
| Methods defined here:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| handler_order = 500
class CacheFTPHandler(FTPHandler)
| Method resolution order:
| CacheFTPHandler
| FTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| check_cache(self)
|
| clear_cache(self)
|
| connect_ftp(self, user, passwd, host, port, dirs, timeout)
|
| setMaxConns(self, m)
|
| setTimeout(self, t)
|
| ----------------------------------------------------------------------
| Methods inherited from FTPHandler:
|
| ftp_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class DataHandler(BaseHandler)
| Method resolution order:
| DataHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| data_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class FTPHandler(BaseHandler)
| Method resolution order:
| FTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| connect_ftp(self, user, passwd, host, port, dirs, timeout)
|
| ftp_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class FancyURLopener(URLopener)
| FancyURLopener(*args, **kwargs)
|
| Derived class with handlers for errors we can handle (perhaps).
|
| Method resolution order:
| FancyURLopener
| URLopener
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_user_passwd(self, host, realm, clear_cache=0)
|
| http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
| Error 301 -- also relocated (permanently).
|
| http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
| Error 302 -- relocated (temporarily).
|
| http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
| Error 303 -- also relocated (essentially identical to 302).
|
| http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
| Error 307 -- relocated, but turn POST into error.
|
| http_error_308(self, url, fp, errcode, errmsg, headers, data=None)
| Error 308 -- relocated, but turn POST into error.
|
| http_error_401(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 401 -- authentication required.
| This function supports Basic authentication only.
|
| http_error_407(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 407 -- proxy authentication required.
| This function supports Basic authentication only.
|
| http_error_default(self, url, fp, errcode, errmsg, headers)
| Default error handling -- don't raise an exception.
|
| prompt_user_passwd(self, host, realm)
| Override this in a GUI environment!
|
| redirect_internal(self, url, fp, errcode, errmsg, headers, data)
|
| retry_http_basic_auth(self, url, realm, data=None)
|
| retry_https_basic_auth(self, url, realm, data=None)
|
| retry_proxy_http_basic_auth(self, url, realm, data=None)
|
| retry_proxy_https_basic_auth(self, url, realm, data=None)
|
| ----------------------------------------------------------------------
| Methods inherited from URLopener:
|
| __del__(self)
|
| addheader(self, *args)
| Add a header to be used by the HTTP interface only
| e.g. u.addheader('Accept', 'sound/basic')
|
| cleanup(self)
|
| close(self)
|
| http_error(self, url, fp, errcode, errmsg, headers, data=None)
| Handle http errors.
|
| Derived class can override this, or provide specific handlers
| named http_error_DDD where DDD is the 3-digit error code.
|
| open(self, fullurl, data=None)
| Use URLopener().open(file) instead of open(file, 'r').
|
| open_data(self, url, data=None)
| Use "data" URL.
|
| open_file(self, url)
| Use local file or FTP depending on form of URL.
|
| open_ftp(self, url)
| Use FTP protocol.
|
| open_http(self, url, data=None)
| Use HTTP protocol.
|
| open_https(self, url, data=None)
| Use HTTPS protocol.
|
| open_local_file(self, url)
| Use local file.
|
| open_unknown(self, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| open_unknown_proxy(self, proxy, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| retrieve(self, url, filename=None, reporthook=None, data=None)
| retrieve(url) returns (filename, headers) for a local object
| or (tempfilename, headers) for a remote object.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from URLopener:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from URLopener:
|
| version = 'Python-urllib/3.12'
class FileHandler(BaseHandler)
| Method resolution order:
| FileHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| file_open(self, req)
| # Use local file or FTP depending on form of URL
|
| get_names(self)
|
| open_local_file(self, req)
| # not entirely sure what the rules are here
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| names = None
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
| HTTPBasicAuthHandler(password_mgr=None)
|
| Method resolution order:
| HTTPBasicAuthHandler
| AbstractBasicAuthHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_401(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Authorization'
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractBasicAuthHandler:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractBasicAuthHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from AbstractBasicAuthHandler:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPCookieProcessor(BaseHandler)
| HTTPCookieProcessor(cookiejar=None)
|
| Method resolution order:
| HTTPCookieProcessor
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self, cookiejar=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_request(self, request)
|
| http_response(self, request, response)
|
| https_request = http_request(self, request)
|
| https_response = http_response(self, request, response)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPDefaultErrorHandler(BaseHandler)
| Method resolution order:
| HTTPDefaultErrorHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_default(self, req, fp, code, msg, hdrs)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler)
| HTTPDigestAuthHandler(passwd=None)
|
| An authentication protocol defined by RFC 2069
|
| Digest authentication improves on basic authentication because it
| does not transmit passwords in the clear.
|
| Method resolution order:
| HTTPDigestAuthHandler
| BaseHandler
| AbstractDigestAuthHandler
| builtins.object
|
| Methods defined here:
|
| http_error_401(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Authorization'
|
| handler_order = 490
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractDigestAuthHandler:
|
| __init__(self, passwd=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_algorithm_impls(self, algorithm)
|
| get_authorization(self, req, chal)
|
| get_cnonce(self, nonce)
|
| get_entity_digest(self, data, chal)
|
| http_error_auth_reqed(self, auth_header, host, req, headers)
|
| reset_retry_count(self)
|
| retry_http_digest_auth(self, req, auth)
class HTTPErrorProcessor(BaseHandler)
| Process HTTP error responses.
|
| Method resolution order:
| HTTPErrorProcessor
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_response(self, request, response)
|
| https_response = http_response(self, request, response)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| handler_order = 1000
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPHandler(AbstractHTTPHandler)
| HTTPHandler(debuglevel=None)
|
| Method resolution order:
| HTTPHandler
| AbstractHTTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_open(self, req)
|
| http_request = do_request_(self, request)
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractHTTPHandler:
|
| __init__(self, debuglevel=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| do_open(self, http_class, req, **http_conn_args)
| Return an HTTPResponse object for the request, using http_class.
|
| http_class must implement the HTTPConnection API from http.client.
|
| do_request_(self, request)
|
| set_http_debuglevel(self, level)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPPasswordMgr(builtins.object)
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd)
|
| find_user_password(self, realm, authuri)
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr)
| Method resolution order:
| HTTPPasswordMgrWithDefaultRealm
| HTTPPasswordMgr
| builtins.object
|
| Methods defined here:
|
| find_user_password(self, realm, authuri)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgr:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd)
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from HTTPPasswordMgr:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm)
| HTTPPasswordMgrWithPriorAuth(*args, **kwargs)
|
| Method resolution order:
| HTTPPasswordMgrWithPriorAuth
| HTTPPasswordMgrWithDefaultRealm
| HTTPPasswordMgr
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd, is_authenticated=False)
|
| is_authenticated(self, authuri)
|
| update_authenticated(self, uri, is_authenticated=False)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgrWithDefaultRealm:
|
| find_user_password(self, realm, authuri)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgr:
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from HTTPPasswordMgr:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class HTTPRedirectHandler(BaseHandler)
| Method resolution order:
| HTTPRedirectHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_301 = http_error_302(self, req, fp, code, msg, headers)
|
| http_error_302(self, req, fp, code, msg, headers)
| # Implementation note: To avoid the server sending us into an
| # infinite loop, the request object needs to track what URLs we
| # have already seen. Do this by adding a handler-specific
| # attribute to the Request object.
|
| http_error_303 = http_error_302(self, req, fp, code, msg, headers)
|
| http_error_307 = http_error_302(self, req, fp, code, msg, headers)
|
| http_error_308 = http_error_302(self, req, fp, code, msg, headers)
|
| redirect_request(self, req, fp, code, msg, headers, newurl)
| Return a Request or None in response to a redirect.
|
| This is called by the http_error_30x methods when a
| redirection response is received. If a redirection should
| take place, return a new Request to allow http_error_30x to
| perform the redirect. Otherwise, raise HTTPError if no-one
| else should try to handle this url. Return None if you can't
| but another Handler might.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| inf_msg = 'The HTTP server returned a redirect error that w...n infini...
|
| max_redirections = 10
|
| max_repeats = 4
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPSHandler(AbstractHTTPHandler)
| HTTPSHandler(debuglevel=None, context=None, check_hostname=None)
|
| Method resolution order:
| HTTPSHandler
| AbstractHTTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self, debuglevel=None, context=None, check_hostname=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| https_open(self, req)
|
| https_request = do_request_(self, request)
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractHTTPHandler:
|
| do_open(self, http_class, req, **http_conn_args)
| Return an HTTPResponse object for the request, using http_class.
|
| http_class must implement the HTTPConnection API from http.client.
|
| do_request_(self, request)
|
| set_http_debuglevel(self, level)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class OpenerDirector(builtins.object)
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_handler(self, handler)
|
| close(self)
|
| error(self, proto, *args)
|
| open(self, fullurl, data=None, timeout=<object object at 0x000001D727B38B80>)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
| ProxyBasicAuthHandler(password_mgr=None)
|
| Method resolution order:
| ProxyBasicAuthHandler
| AbstractBasicAuthHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_407(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Proxy-authorization'
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractBasicAuthHandler:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractBasicAuthHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from AbstractBasicAuthHandler:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler)
| ProxyDigestAuthHandler(passwd=None)
|
| Method resolution order:
| ProxyDigestAuthHandler
| BaseHandler
| AbstractDigestAuthHandler
| builtins.object
|
| Methods defined here:
|
| http_error_407(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Proxy-Authorization'
|
| handler_order = 490
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractDigestAuthHandler:
|
| __init__(self, passwd=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_algorithm_impls(self, algorithm)
|
| get_authorization(self, req, chal)
|
| get_cnonce(self, nonce)
|
| get_entity_digest(self, data, chal)
|
| http_error_auth_reqed(self, auth_header, host, req, headers)
|
| reset_retry_count(self)
|
| retry_http_digest_auth(self, req, auth)
class ProxyHandler(BaseHandler)
| ProxyHandler(proxies=None)
|
| Method resolution order:
| ProxyHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self, proxies=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| proxy_open(self, req, proxy, type)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| handler_order = 100
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Request(builtins.object)
| Request(url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None)
|
| Methods defined here:
|
| __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_header(self, key, val)
|
| add_unredirected_header(self, key, val)
|
| get_full_url(self)
|
| get_header(self, header_name, default=None)
|
| get_method(self)
| Return a string indicating the HTTP request method.
|
| has_header(self, header_name)
|
| has_proxy(self)
|
| header_items(self)
|
| remove_header(self, header_name)
|
| set_proxy(self, host, type)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| data
|
| full_url
class URLopener(builtins.object)
| URLopener(proxies=None, **x509)
|
| Class to open URLs.
| This is a class rather than just a subroutine because we may need
| more than one set of global protocol-specific options.
| Note -- this is a base class for those who don't want the
| automatic handling of errors type 302 (relocated) and 401
| (authorization needed).
|
| Methods defined here:
|
| __del__(self)
|
| __init__(self, proxies=None, **x509)
| Initialize self. See help(type(self)) for accurate signature.
|
| addheader(self, *args)
| Add a header to be used by the HTTP interface only
| e.g. u.addheader('Accept', 'sound/basic')
|
| cleanup(self)
|
| close(self)
|
| http_error(self, url, fp, errcode, errmsg, headers, data=None)
| Handle http errors.
|
| Derived class can override this, or provide specific handlers
| named http_error_DDD where DDD is the 3-digit error code.
|
| http_error_default(self, url, fp, errcode, errmsg, headers)
| Default error handler: close the connection and raise OSError.
|
| open(self, fullurl, data=None)
| Use URLopener().open(file) instead of open(file, 'r').
|
| open_data(self, url, data=None)
| Use "data" URL.
|
| open_file(self, url)
| Use local file or FTP depending on form of URL.
|
| open_ftp(self, url)
| Use FTP protocol.
|
| open_http(self, url, data=None)
| Use HTTP protocol.
|
| open_https(self, url, data=None)
| Use HTTPS protocol.
|
| open_local_file(self, url)
| Use local file.
|
| open_unknown(self, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| open_unknown_proxy(self, proxy, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| retrieve(self, url, filename=None, reporthook=None, data=None)
| retrieve(url) returns (filename, headers) for a local object
| or (tempfilename, headers) for a remote object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| version = 'Python-urllib/3.12'
class UnknownHandler(BaseHandler)
| Method resolution order:
| UnknownHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| unknown_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
FUNCTIONS
build_opener(*handlers)
Create an opener object from a list of handlers.
The opener will use several default handlers, including support
for HTTP, FTP and when applicable HTTPS.
If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used.
getproxies()
Return a dictionary of scheme -> proxy server URL mappings.
Returns settings gathered from the environment, if specified,
or the registry.
install_opener(opener)
pathname2url(p)
OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.
url2pathname(url)
OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use.
urlcleanup()
Clean up temporary files from urlretrieve calls.
urlopen(url, data=None, timeout=<object object at 0x000001D727B38B80>, *, cafile=None, capath=None, cadefault=False, context=None)
Open the URL url, which can be either a string or a Request object.
*data* must be an object specifying additional data to be sent to
the server, or None if no such data is needed. See Request for
details.
urllib.request module uses HTTP/1.1 and includes a "Connection:close"
header in its HTTP requests.
The optional *timeout* parameter specifies a timeout in seconds for
blocking operations like the connection attempt (if not specified, the
global default timeout setting will be used). This only works for HTTP,
HTTPS and FTP connections.
If *context* is specified, it must be a ssl.SSLContext instance describing
the various SSL options. See HTTPSConnection for more details.
The optional *cafile* and *capath* parameters specify a set of trusted CA
certificates for HTTPS requests. cafile should point to a single file
containing a bundle of CA certificates, whereas capath should point to a
directory of hashed certificate files. More information can be found in
ssl.SSLContext.load_verify_locations().
The *cadefault* parameter is ignored.
This function always returns an object which can work as a
context manager and has the properties url, headers, and status.
See urllib.response.addinfourl for more detail on these properties.
For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse
object slightly modified. In addition to the three new methods above, the
msg attribute contains the same information as the reason attribute ---
the reason phrase returned by the server --- instead of the response
headers as it is specified in the documentation for HTTPResponse.
For FTP, file, and data URLs and requests explicitly handled by legacy
URLopener and FancyURLopener classes, this function returns a
urllib.response.addinfourl object.
Note that None may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).
In addition, if proxy settings are detected (for example, when a *_proxy
environment variable like http_proxy is set), ProxyHandler is default
installed and makes sure the requests are handled through the proxy.
urlretrieve(url, filename=None, reporthook=None, data=None)
Retrieve a URL into a temporary location on disk.
Requires a URL argument. If a filename is passed, it is used as
the temporary file location. The reporthook argument should be
a callable that accepts a block number, a read size, and the
total file size of the URL target. The data argument should be
valid URL encoded data.
If a filename is passed and the URL points to a local resource,
the result is a copy from local file to new file.
Returns a tuple containing the path to the newly created
data file as well as the resulting HTTPMessage object.
DATA
__all__ = ['Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErr...
VERSION
3.12
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\request.py
urllib.response
Python Library Documentation: module urllib.response in urllib
NAME
urllib.response - Response classes used by urllib.
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.response.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
The base class, addbase, defines a minimal file-like interface,
including read() and readline(). The typical response object is an
addinfourl instance, which defines an info() method that returns
headers and a geturl() method that returns the url.
CLASSES
tempfile._TemporaryFileWrapper(builtins.object)
addbase
addclosehook
addinfo
addinfourl
class addbase(tempfile._TemporaryFileWrapper)
| addbase(fp)
|
| Base class for addinfo and addclosehook. Is a good idea for garbage collection.
|
| Method resolution order:
| addbase
| tempfile._TemporaryFileWrapper
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, type, value, traceback)
|
| __init__(self, fp)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from tempfile._TemporaryFileWrapper:
|
| __getattr__(self, name)
|
| __iter__(self)
| # iter() doesn't use __getattr__ to find the __iter__ method
|
| close(self)
| Close the temporary file, possibly deleting it.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from tempfile._TemporaryFileWrapper:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class addclosehook(addbase)
| addclosehook(fp, closehook, *hookargs)
|
| Class to add a close hook to an open file.
|
| Method resolution order:
| addclosehook
| addbase
| tempfile._TemporaryFileWrapper
| builtins.object
|
| Methods defined here:
|
| __init__(self, fp, closehook, *hookargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(self)
| Close the temporary file, possibly deleting it.
|
| ----------------------------------------------------------------------
| Methods inherited from addbase:
|
| __enter__(self)
|
| __exit__(self, type, value, traceback)
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from tempfile._TemporaryFileWrapper:
|
| __getattr__(self, name)
|
| __iter__(self)
| # iter() doesn't use __getattr__ to find the __iter__ method
|
| ----------------------------------------------------------------------
| Data descriptors inherited from tempfile._TemporaryFileWrapper:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class addinfo(addbase)
| addinfo(fp, headers)
|
| class to add an info() method to an open file.
|
| Method resolution order:
| addinfo
| addbase
| tempfile._TemporaryFileWrapper
| builtins.object
|
| Methods defined here:
|
| __init__(self, fp, headers)
| Initialize self. See help(type(self)) for accurate signature.
|
| info(self)
|
| ----------------------------------------------------------------------
| Methods inherited from addbase:
|
| __enter__(self)
|
| __exit__(self, type, value, traceback)
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from tempfile._TemporaryFileWrapper:
|
| __getattr__(self, name)
|
| __iter__(self)
| # iter() doesn't use __getattr__ to find the __iter__ method
|
| close(self)
| Close the temporary file, possibly deleting it.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from tempfile._TemporaryFileWrapper:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class addinfourl(addinfo)
| addinfourl(fp, headers, url, code=None)
|
| class to add info() and geturl() methods to an open file.
|
| Method resolution order:
| addinfourl
| addinfo
| addbase
| tempfile._TemporaryFileWrapper
| builtins.object
|
| Methods defined here:
|
| __init__(self, fp, headers, url, code=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| getcode(self)
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| status
|
| ----------------------------------------------------------------------
| Methods inherited from addinfo:
|
| info(self)
|
| ----------------------------------------------------------------------
| Methods inherited from addbase:
|
| __enter__(self)
|
| __exit__(self, type, value, traceback)
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Methods inherited from tempfile._TemporaryFileWrapper:
|
| __getattr__(self, name)
|
| __iter__(self)
| # iter() doesn't use __getattr__ to find the __iter__ method
|
| close(self)
| Close the temporary file, possibly deleting it.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from tempfile._TemporaryFileWrapper:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
__all__ = ['addbase', 'addclosehook', 'addinfo', 'addinfourl']
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\response.py
urllib.robotparser
Python Library Documentation: module urllib.robotparser in urllib
NAME
urllib.robotparser - robotparser.py
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.robotparser.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
Copyright (C) 2000 Bastian Kleineidam
You can choose between two licenses when using this package:
1) GNU GPLv2
2) PSF license for Python 2.2
The robots.txt Exclusion Protocol is implemented as specified in
http://www.robotstxt.org/norobots-rfc.txt
CLASSES
builtins.object
RobotFileParser
class RobotFileParser(builtins.object)
| RobotFileParser(url='')
|
| This class provides a set of methods to read, parse and answer
| questions about a single robots.txt file.
|
| Methods defined here:
|
| __init__(self, url='')
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| can_fetch(self, useragent, url)
| using the parsed robots.txt decide if useragent can fetch url
|
| crawl_delay(self, useragent)
|
| modified(self)
| Sets the time the robots.txt file was last fetched to the
| current time.
|
| mtime(self)
| Returns the time the robots.txt file was last fetched.
|
| This is useful for long-running web spiders that need to
| check for new robots.txt files periodically.
|
| parse(self, lines)
| Parse the input lines from a robots.txt file.
|
| We allow that a user-agent: line is not preceded by
| one or more blank lines.
|
| read(self)
| Reads the robots.txt URL and feeds it to the parser.
|
| request_rate(self, useragent)
|
| set_url(self, url)
| Sets the URL referring to a robots.txt file.
|
| site_maps(self)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
DATA
__all__ = ['RobotFileParser']
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\robotparser.py
urllib.request.AbstractBasicAuthHandler
Python Library Documentation: class AbstractBasicAuthHandler in module urllib.request
class AbstractBasicAuthHandler(builtins.object)
| AbstractBasicAuthHandler(password_mgr=None)
|
| Methods defined here:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
urllib.request.AbstractDigestAuthHandler
Python Library Documentation: class AbstractDigestAuthHandler in module urllib.request class AbstractDigestAuthHandler(builtins.object) | AbstractDigestAuthHandler(passwd=None) | | Methods defined here: | | __init__(self, passwd=None) | Initialize self. See help(type(self)) for accurate signature. | | get_algorithm_impls(self, algorithm) | | get_authorization(self, req, chal) | | get_cnonce(self, nonce) | | get_entity_digest(self, data, chal) | | http_error_auth_reqed(self, auth_header, host, req, headers) | | reset_retry_count(self) | | retry_http_digest_auth(self, req, auth) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.AbstractHTTPHandler
Python Library Documentation: class AbstractHTTPHandler in module urllib.request class AbstractHTTPHandler(BaseHandler) | AbstractHTTPHandler(debuglevel=None) | | Method resolution order: | AbstractHTTPHandler | BaseHandler | builtins.object | | Methods defined here: | | __init__(self, debuglevel=None) | Initialize self. See help(type(self)) for accurate signature. | | do_open(self, http_class, req, **http_conn_args) | Return an HTTPResponse object for the request, using http_class. | | http_class must implement the HTTPConnection API from http.client. | | do_request_(self, request) | | set_http_debuglevel(self, level) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.BaseHandler
Python Library Documentation: class BaseHandler in module urllib.request class BaseHandler(builtins.object) | Methods defined here: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | handler_order = 500
urllib.request.CacheFTPHandler
Python Library Documentation: class CacheFTPHandler in module urllib.request class CacheFTPHandler(FTPHandler) | Method resolution order: | CacheFTPHandler | FTPHandler | BaseHandler | builtins.object | | Methods defined here: | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | check_cache(self) | | clear_cache(self) | | connect_ftp(self, user, passwd, host, port, dirs, timeout) | | setMaxConns(self, m) | | setTimeout(self, t) | | ---------------------------------------------------------------------- | Methods inherited from FTPHandler: | | ftp_open(self, req) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.ContentTooShortError
Python Library Documentation: class ContentTooShortError in module urllib.error class ContentTooShortError(URLError) | ContentTooShortError(message, content) | | Exception raised when downloaded size does not match content-length. | | Method resolution order: | ContentTooShortError | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, message, content) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from URLError: | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors inherited from URLError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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
urllib.request.DataHandler
Python Library Documentation: class DataHandler in module urllib.request class DataHandler(BaseHandler) | Method resolution order: | DataHandler | BaseHandler | builtins.object | | Methods defined here: | | data_open(self, req) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.FTPHandler
Python Library Documentation: class FTPHandler in module urllib.request class FTPHandler(BaseHandler) | Method resolution order: | FTPHandler | BaseHandler | builtins.object | | Methods defined here: | | connect_ftp(self, user, passwd, host, port, dirs, timeout) | | ftp_open(self, req) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.FancyURLopener
Python Library Documentation: class FancyURLopener in module urllib.request
class FancyURLopener(URLopener)
| FancyURLopener(*args, **kwargs)
|
| Derived class with handlers for errors we can handle (perhaps).
|
| Method resolution order:
| FancyURLopener
| URLopener
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_user_passwd(self, host, realm, clear_cache=0)
|
| http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
| Error 301 -- also relocated (permanently).
|
| http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
| Error 302 -- relocated (temporarily).
|
| http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
| Error 303 -- also relocated (essentially identical to 302).
|
| http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
| Error 307 -- relocated, but turn POST into error.
|
| http_error_308(self, url, fp, errcode, errmsg, headers, data=None)
| Error 308 -- relocated, but turn POST into error.
|
| http_error_401(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 401 -- authentication required.
| This function supports Basic authentication only.
|
| http_error_407(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 407 -- proxy authentication required.
| This function supports Basic authentication only.
|
| http_error_default(self, url, fp, errcode, errmsg, headers)
| Default error handling -- don't raise an exception.
|
| prompt_user_passwd(self, host, realm)
| Override this in a GUI environment!
|
| redirect_internal(self, url, fp, errcode, errmsg, headers, data)
|
| retry_http_basic_auth(self, url, realm, data=None)
|
| retry_https_basic_auth(self, url, realm, data=None)
|
| retry_proxy_http_basic_auth(self, url, realm, data=None)
|
| retry_proxy_https_basic_auth(self, url, realm, data=None)
|
| ----------------------------------------------------------------------
| Methods inherited from URLopener:
|
| __del__(self)
|
| addheader(self, *args)
| Add a header to be used by the HTTP interface only
| e.g. u.addheader('Accept', 'sound/basic')
|
| cleanup(self)
|
| close(self)
|
| http_error(self, url, fp, errcode, errmsg, headers, data=None)
| Handle http errors.
|
| Derived class can override this, or provide specific handlers
| named http_error_DDD where DDD is the 3-digit error code.
|
| open(self, fullurl, data=None)
| Use URLopener().open(file) instead of open(file, 'r').
|
| open_data(self, url, data=None)
| Use "data" URL.
|
| open_file(self, url)
| Use local file or FTP depending on form of URL.
|
| open_ftp(self, url)
| Use FTP protocol.
|
| open_http(self, url, data=None)
| Use HTTP protocol.
|
| open_https(self, url, data=None)
| Use HTTPS protocol.
|
| open_local_file(self, url)
| Use local file.
|
| open_unknown(self, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| open_unknown_proxy(self, proxy, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| retrieve(self, url, filename=None, reporthook=None, data=None)
| retrieve(url) returns (filename, headers) for a local object
| or (tempfilename, headers) for a remote object.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from URLopener:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from URLopener:
|
| version = 'Python-urllib/3.12'
urllib.request.FileHandler
Python Library Documentation: class FileHandler in module urllib.request class FileHandler(BaseHandler) | Method resolution order: | FileHandler | BaseHandler | builtins.object | | Methods defined here: | | file_open(self, req) | # Use local file or FTP depending on form of URL | | get_names(self) | | open_local_file(self, req) | # not entirely sure what the rules are here | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | names = None | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.HTTPBasicAuthHandler
Python Library Documentation: class HTTPBasicAuthHandler in module urllib.request
class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
| HTTPBasicAuthHandler(password_mgr=None)
|
| Method resolution order:
| HTTPBasicAuthHandler
| AbstractBasicAuthHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_401(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Authorization'
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractBasicAuthHandler:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractBasicAuthHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from AbstractBasicAuthHandler:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
urllib.request.HTTPCookieProcessor
Python Library Documentation: class HTTPCookieProcessor in module urllib.request class HTTPCookieProcessor(BaseHandler) | HTTPCookieProcessor(cookiejar=None) | | Method resolution order: | HTTPCookieProcessor | BaseHandler | builtins.object | | Methods defined here: | | __init__(self, cookiejar=None) | Initialize self. See help(type(self)) for accurate signature. | | http_request(self, request) | | http_response(self, request, response) | | https_request = http_request(self, request) | | https_response = http_response(self, request, response) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.HTTPDefaultErrorHandler
Python Library Documentation: class HTTPDefaultErrorHandler in module urllib.request class HTTPDefaultErrorHandler(BaseHandler) | Method resolution order: | HTTPDefaultErrorHandler | BaseHandler | builtins.object | | Methods defined here: | | http_error_default(self, req, fp, code, msg, hdrs) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.HTTPDigestAuthHandler
Python Library Documentation: class HTTPDigestAuthHandler in module urllib.request class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler) | HTTPDigestAuthHandler(passwd=None) | | An authentication protocol defined by RFC 2069 | | Digest authentication improves on basic authentication because it | does not transmit passwords in the clear. | | Method resolution order: | HTTPDigestAuthHandler | BaseHandler | AbstractDigestAuthHandler | builtins.object | | Methods defined here: | | http_error_401(self, req, fp, code, msg, headers) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | auth_header = 'Authorization' | | handler_order = 490 | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from AbstractDigestAuthHandler: | | __init__(self, passwd=None) | Initialize self. See help(type(self)) for accurate signature. | | get_algorithm_impls(self, algorithm) | | get_authorization(self, req, chal) | | get_cnonce(self, nonce) | | get_entity_digest(self, data, chal) | | http_error_auth_reqed(self, auth_header, host, req, headers) | | reset_retry_count(self) | | retry_http_digest_auth(self, req, auth)
urllib.request.HTTPError
Python Library Documentation: class HTTPError in module urllib.error class HTTPError(URLError, urllib.response.addinfourl) | HTTPError(url, code, msg, hdrs, fp) | | Raised when HTTP error occurs, but also acts like non-error return | | Method resolution order: | HTTPError | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | urllib.response.addinfourl | urllib.response.addinfo | urllib.response.addbase | tempfile._TemporaryFileWrapper | builtins.object | | Methods defined here: | | __init__(self, url, code, msg, hdrs, fp) | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Readonly properties defined here: | | reason | | ---------------------------------------------------------------------- | Data descriptors defined here: | | headers | | ---------------------------------------------------------------------- | Data descriptors inherited from URLError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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). | | __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 | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addinfourl: | | getcode(self) | | geturl(self) | | ---------------------------------------------------------------------- | Readonly properties inherited from urllib.response.addinfourl: | | status | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addinfo: | | info(self) | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addbase: | | __enter__(self) | | __exit__(self, type, value, traceback) | | ---------------------------------------------------------------------- | Methods inherited from tempfile._TemporaryFileWrapper: | | __getattr__(self, name) | | __iter__(self) | # iter() doesn't use __getattr__ to find the __iter__ method | | close(self) | Close the temporary file, possibly deleting it.
urllib.request.HTTPErrorProcessor
Python Library Documentation: class HTTPErrorProcessor in module urllib.request class HTTPErrorProcessor(BaseHandler) | Process HTTP error responses. | | Method resolution order: | HTTPErrorProcessor | BaseHandler | builtins.object | | Methods defined here: | | http_response(self, request, response) | | https_response = http_response(self, request, response) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | handler_order = 1000 | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.HTTPHandler
Python Library Documentation: class HTTPHandler in module urllib.request class HTTPHandler(AbstractHTTPHandler) | HTTPHandler(debuglevel=None) | | Method resolution order: | HTTPHandler | AbstractHTTPHandler | BaseHandler | builtins.object | | Methods defined here: | | http_open(self, req) | | http_request = do_request_(self, request) | | ---------------------------------------------------------------------- | Methods inherited from AbstractHTTPHandler: | | __init__(self, debuglevel=None) | Initialize self. See help(type(self)) for accurate signature. | | do_open(self, http_class, req, **http_conn_args) | Return an HTTPResponse object for the request, using http_class. | | http_class must implement the HTTPConnection API from http.client. | | do_request_(self, request) | | set_http_debuglevel(self, level) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.HTTPPasswordMgr
Python Library Documentation: class HTTPPasswordMgr in module urllib.request class HTTPPasswordMgr(builtins.object) | Methods defined here: | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | add_password(self, realm, uri, user, passwd) | | find_user_password(self, realm, authuri) | | is_suburi(self, base, test) | Check if test is below base in a URI tree | | Both args must be URIs in reduced form. | | reduce_uri(self, uri, default_port=True) | Accept authority or URI and extract only the authority and path. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.HTTPPasswordMgrWithDefaultRealm
Python Library Documentation: class HTTPPasswordMgrWithDefaultRealm in module urllib.request class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr) | Method resolution order: | HTTPPasswordMgrWithDefaultRealm | HTTPPasswordMgr | builtins.object | | Methods defined here: | | find_user_password(self, realm, authuri) | | ---------------------------------------------------------------------- | Methods inherited from HTTPPasswordMgr: | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | add_password(self, realm, uri, user, passwd) | | is_suburi(self, base, test) | Check if test is below base in a URI tree | | Both args must be URIs in reduced form. | | reduce_uri(self, uri, default_port=True) | Accept authority or URI and extract only the authority and path. | | ---------------------------------------------------------------------- | Data descriptors inherited from HTTPPasswordMgr: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.HTTPPasswordMgrWithPriorAuth
Python Library Documentation: class HTTPPasswordMgrWithPriorAuth in module urllib.request class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm) | HTTPPasswordMgrWithPriorAuth(*args, **kwargs) | | Method resolution order: | HTTPPasswordMgrWithPriorAuth | HTTPPasswordMgrWithDefaultRealm | HTTPPasswordMgr | builtins.object | | Methods defined here: | | __init__(self, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | add_password(self, realm, uri, user, passwd, is_authenticated=False) | | is_authenticated(self, authuri) | | update_authenticated(self, uri, is_authenticated=False) | | ---------------------------------------------------------------------- | Methods inherited from HTTPPasswordMgrWithDefaultRealm: | | find_user_password(self, realm, authuri) | | ---------------------------------------------------------------------- | Methods inherited from HTTPPasswordMgr: | | is_suburi(self, base, test) | Check if test is below base in a URI tree | | Both args must be URIs in reduced form. | | reduce_uri(self, uri, default_port=True) | Accept authority or URI and extract only the authority and path. | | ---------------------------------------------------------------------- | Data descriptors inherited from HTTPPasswordMgr: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.HTTPRedirectHandler
Python Library Documentation: class HTTPRedirectHandler in module urllib.request class HTTPRedirectHandler(BaseHandler) | Method resolution order: | HTTPRedirectHandler | BaseHandler | builtins.object | | Methods defined here: | | http_error_301 = http_error_302(self, req, fp, code, msg, headers) | | http_error_302(self, req, fp, code, msg, headers) | # Implementation note: To avoid the server sending us into an | # infinite loop, the request object needs to track what URLs we | # have already seen. Do this by adding a handler-specific | # attribute to the Request object. | | http_error_303 = http_error_302(self, req, fp, code, msg, headers) | | http_error_307 = http_error_302(self, req, fp, code, msg, headers) | | http_error_308 = http_error_302(self, req, fp, code, msg, headers) | | redirect_request(self, req, fp, code, msg, headers, newurl) | Return a Request or None in response to a redirect. | | This is called by the http_error_30x methods when a | redirection response is received. If a redirection should | take place, return a new Request to allow http_error_30x to | perform the redirect. Otherwise, raise HTTPError if no-one | else should try to handle this url. Return None if you can't | but another Handler might. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | inf_msg = 'The HTTP server returned a redirect error that w...n infini... | | max_redirections = 10 | | max_repeats = 4 | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.HTTPSHandler
Python Library Documentation: class HTTPSHandler in module urllib.request class HTTPSHandler(AbstractHTTPHandler) | HTTPSHandler(debuglevel=None, context=None, check_hostname=None) | | Method resolution order: | HTTPSHandler | AbstractHTTPHandler | BaseHandler | builtins.object | | Methods defined here: | | __init__(self, debuglevel=None, context=None, check_hostname=None) | Initialize self. See help(type(self)) for accurate signature. | | https_open(self, req) | | https_request = do_request_(self, request) | | ---------------------------------------------------------------------- | Methods inherited from AbstractHTTPHandler: | | do_open(self, http_class, req, **http_conn_args) | Return an HTTPResponse object for the request, using http_class. | | http_class must implement the HTTPConnection API from http.client. | | do_request_(self, request) | | set_http_debuglevel(self, level) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.MAXFTPCACHE
Python Library Documentation: int object
class int(object)
| int([x]) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating-point
| numbers, this truncates towards zero.
|
| If x is not a number or if base is given, then x must be a string,
| bytes, or bytearray instance representing an integer literal in the
| given base. The literal can be preceded by '+' or '-' and be surrounded
| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
| Base 0 means to interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Built-in subclasses:
| bool
|
| Methods defined here:
|
| __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.
|
| __format__(self, format_spec, /)
| Convert to a string according to format_spec.
|
| __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).
|
| __repr__(self, /)
| Return repr(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 defined here:
|
| 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.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| 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
urllib.request.OpenerDirector
Python Library Documentation: class OpenerDirector in module urllib.request class OpenerDirector(builtins.object) | Methods defined here: | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | add_handler(self, handler) | | close(self) | | error(self, proto, *args) | | open(self, fullurl, data=None, timeout=<object object at 0x000001D727B38B80>) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.ProxyBasicAuthHandler
Python Library Documentation: class ProxyBasicAuthHandler in module urllib.request
class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
| ProxyBasicAuthHandler(password_mgr=None)
|
| Method resolution order:
| ProxyBasicAuthHandler
| AbstractBasicAuthHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_407(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Proxy-authorization'
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractBasicAuthHandler:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractBasicAuthHandler:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from AbstractBasicAuthHandler:
|
| rx = re.compile('(?:^|,)[ \t]*([^ \t,]+)[ \t]+realm=(["\']?)([^"\']*)\...
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self<value.
|
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
urllib.request.ProxyDigestAuthHandler
Python Library Documentation: class ProxyDigestAuthHandler in module urllib.request class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler) | ProxyDigestAuthHandler(passwd=None) | | Method resolution order: | ProxyDigestAuthHandler | BaseHandler | AbstractDigestAuthHandler | builtins.object | | Methods defined here: | | http_error_407(self, req, fp, code, msg, headers) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | auth_header = 'Proxy-Authorization' | | handler_order = 490 | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from AbstractDigestAuthHandler: | | __init__(self, passwd=None) | Initialize self. See help(type(self)) for accurate signature. | | get_algorithm_impls(self, algorithm) | | get_authorization(self, req, chal) | | get_cnonce(self, nonce) | | get_entity_digest(self, data, chal) | | http_error_auth_reqed(self, auth_header, host, req, headers) | | reset_retry_count(self) | | retry_http_digest_auth(self, req, auth)
urllib.request.ProxyHandler
Python Library Documentation: class ProxyHandler in module urllib.request class ProxyHandler(BaseHandler) | ProxyHandler(proxies=None) | | Method resolution order: | ProxyHandler | BaseHandler | builtins.object | | Methods defined here: | | __init__(self, proxies=None) | Initialize self. See help(type(self)) for accurate signature. | | proxy_open(self, req, proxy, type) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | handler_order = 100 | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.Request
Python Library Documentation: class Request in module urllib.request
class Request(builtins.object)
| Request(url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None)
|
| Methods defined here:
|
| __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_header(self, key, val)
|
| add_unredirected_header(self, key, val)
|
| get_full_url(self)
|
| get_header(self, header_name, default=None)
|
| get_method(self)
| Return a string indicating the HTTP request method.
|
| has_header(self, header_name)
|
| has_proxy(self)
|
| header_items(self)
|
| remove_header(self, header_name)
|
| set_proxy(self, host, type)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| data
|
| full_url
urllib.request.URLError
Python Library Documentation: class URLError in module urllib.error class URLError(builtins.OSError) | URLError(reason, filename=None) | | Method resolution order: | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, reason, filename=None) | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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
urllib.request.URLopener
Python Library Documentation: class URLopener in module urllib.request
class URLopener(builtins.object)
| URLopener(proxies=None, **x509)
|
| Class to open URLs.
| This is a class rather than just a subroutine because we may need
| more than one set of global protocol-specific options.
| Note -- this is a base class for those who don't want the
| automatic handling of errors type 302 (relocated) and 401
| (authorization needed).
|
| Methods defined here:
|
| __del__(self)
|
| __init__(self, proxies=None, **x509)
| Initialize self. See help(type(self)) for accurate signature.
|
| addheader(self, *args)
| Add a header to be used by the HTTP interface only
| e.g. u.addheader('Accept', 'sound/basic')
|
| cleanup(self)
|
| close(self)
|
| http_error(self, url, fp, errcode, errmsg, headers, data=None)
| Handle http errors.
|
| Derived class can override this, or provide specific handlers
| named http_error_DDD where DDD is the 3-digit error code.
|
| http_error_default(self, url, fp, errcode, errmsg, headers)
| Default error handler: close the connection and raise OSError.
|
| open(self, fullurl, data=None)
| Use URLopener().open(file) instead of open(file, 'r').
|
| open_data(self, url, data=None)
| Use "data" URL.
|
| open_file(self, url)
| Use local file or FTP depending on form of URL.
|
| open_ftp(self, url)
| Use FTP protocol.
|
| open_http(self, url, data=None)
| Use HTTP protocol.
|
| open_https(self, url, data=None)
| Use HTTPS protocol.
|
| open_local_file(self, url)
| Use local file.
|
| open_unknown(self, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| open_unknown_proxy(self, proxy, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| retrieve(self, url, filename=None, reporthook=None, data=None)
| retrieve(url) returns (filename, headers) for a local object
| or (tempfilename, headers) for a remote object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| version = 'Python-urllib/3.12'
urllib.request.UnknownHandler
Python Library Documentation: class UnknownHandler in module urllib.request class UnknownHandler(BaseHandler) | Method resolution order: | UnknownHandler | BaseHandler | builtins.object | | Methods defined here: | | unknown_open(self, req) | | ---------------------------------------------------------------------- | Methods inherited from BaseHandler: | | __lt__(self, other) | Return self<value. | | add_parent(self, parent) | | close(self) | | ---------------------------------------------------------------------- | Data descriptors inherited from BaseHandler: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Data and other attributes inherited from BaseHandler: | | handler_order = 500
urllib.request.addclosehook
Python Library Documentation: class addclosehook in module urllib.response class addclosehook(addbase) | addclosehook(fp, closehook, *hookargs) | | Class to add a close hook to an open file. | | Method resolution order: | addclosehook | addbase | tempfile._TemporaryFileWrapper | builtins.object | | Methods defined here: | | __init__(self, fp, closehook, *hookargs) | Initialize self. See help(type(self)) for accurate signature. | | close(self) | Close the temporary file, possibly deleting it. | | ---------------------------------------------------------------------- | Methods inherited from addbase: | | __enter__(self) | | __exit__(self, type, value, traceback) | | __repr__(self) | Return repr(self). | | ---------------------------------------------------------------------- | Methods inherited from tempfile._TemporaryFileWrapper: | | __getattr__(self, name) | | __iter__(self) | # iter() doesn't use __getattr__ to find the __iter__ method | | ---------------------------------------------------------------------- | Data descriptors inherited from tempfile._TemporaryFileWrapper: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.addinfourl
Python Library Documentation: class addinfourl in module urllib.response class addinfourl(addinfo) | addinfourl(fp, headers, url, code=None) | | class to add info() and geturl() methods to an open file. | | Method resolution order: | addinfourl | addinfo | addbase | tempfile._TemporaryFileWrapper | builtins.object | | Methods defined here: | | __init__(self, fp, headers, url, code=None) | Initialize self. See help(type(self)) for accurate signature. | | getcode(self) | | geturl(self) | | ---------------------------------------------------------------------- | Readonly properties defined here: | | status | | ---------------------------------------------------------------------- | Methods inherited from addinfo: | | info(self) | | ---------------------------------------------------------------------- | Methods inherited from addbase: | | __enter__(self) | | __exit__(self, type, value, traceback) | | __repr__(self) | Return repr(self). | | ---------------------------------------------------------------------- | Methods inherited from tempfile._TemporaryFileWrapper: | | __getattr__(self, name) | | __iter__(self) | # iter() doesn't use __getattr__ to find the __iter__ method | | close(self) | Close the temporary file, possibly deleting it. | | ---------------------------------------------------------------------- | Data descriptors inherited from tempfile._TemporaryFileWrapper: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.base64
Python Library Documentation: module base64
NAME
base64 - Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings
MODULE REFERENCE
https://docs.python.org/3.12/library/base64.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.
FUNCTIONS
a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\x0b')
Decode the Ascii85 encoded bytes-like object or ASCII string b.
foldspaces is a flag that specifies whether the 'y' short sequence should be
accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
not supported by the "standard" Adobe encoding.
adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
is framed with <~ and ~>).
ignorechars should be a byte string containing characters to ignore from the
input. This should only contain whitespace characters, and by default
contains all whitespace characters in ASCII.
The result is returned as a bytes object.
a85encode(b, *, foldspaces=False, wrapcol=0, pad=False, adobe=False)
Encode bytes-like object b using Ascii85 and return a bytes object.
foldspaces is an optional flag that uses the special short sequence 'y'
instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
feature is not supported by the "standard" Adobe encoding.
wrapcol controls whether the output should have newline (b'\n') characters
added to it. If this is non-zero, each output line will be at most this
many characters long, excluding the trailing newline.
pad controls whether the input is padded to a multiple of 4 before
encoding. Note that the btoa implementation always pads.
adobe controls whether the encoded byte sequence is framed with <~ and ~>,
which is used by the Adobe implementation.
b16decode(s, casefold=False)
Decode the Base16 encoded bytes-like object or ASCII string s.
Optional casefold is a flag specifying whether a lowercase alphabet is
acceptable as input. For security purposes, the default is False.
The result is returned as a bytes object. A binascii.Error is raised if
s is incorrectly padded or if there are non-alphabet characters present
in the input.
b16encode(s)
Encode the bytes-like object s using Base16 and return a bytes object.
b32decode(s, casefold=False, map01=None)
Decode the base32 encoded bytes-like object or ASCII string s.
Optional casefold is a flag specifying whether a lowercase alphabet is
acceptable as input. For security purposes, the default is False.
RFC 3548 allows for optional mapping of the digit 0 (zero) to the
letter O (oh), and for optional mapping of the digit 1 (one) to
either the letter I (eye) or letter L (el). The optional argument
map01 when not None, specifies which letter the digit 1 should be
mapped to (when map01 is not None, the digit 0 is always mapped to
the letter O). For security purposes the default is None, so that
0 and 1 are not allowed in the input.
The result is returned as a bytes object. A binascii.Error is raised if
the input is incorrectly padded or if there are non-alphabet
characters present in the input.
b32encode(s)
Encode the bytes-like objects using base32 and return a bytes object.
b32hexdecode(s, casefold=False)
Decode the base32hex encoded bytes-like object or ASCII string s.
Optional casefold is a flag specifying whether a lowercase alphabet is
acceptable as input. For security purposes, the default is False.
The result is returned as a bytes object. A binascii.Error is raised if
the input is incorrectly padded or if there are non-alphabet
characters present in the input.
b32hexencode(s)
Encode the bytes-like objects using base32hex and return a bytes object.
b64decode(s, altchars=None, validate=False)
Decode the Base64 encoded bytes-like object or ASCII string s.
Optional altchars must be a bytes-like object or ASCII string of length 2
which specifies the alternative alphabet used instead of the '+' and '/'
characters.
The result is returned as a bytes object. A binascii.Error is raised if
s is incorrectly padded.
If validate is False (the default), characters that are neither in the
normal base-64 alphabet nor the alternative alphabet are discarded prior
to the padding check. If validate is True, these non-alphabet characters
in the input result in a binascii.Error.
For more information about the strict base64 check, see:
https://docs.python.org/3.11/library/binascii.html#binascii.a2b_base64
b64encode(s, altchars=None)
Encode the bytes-like object s using Base64 and return a bytes object.
Optional altchars should be a byte string of length 2 which specifies an
alternative alphabet for the '+' and '/' characters. This allows an
application to e.g. generate url or filesystem safe Base64 strings.
b85decode(b)
Decode the base85-encoded bytes-like object or ASCII string b
The result is returned as a bytes object.
b85encode(b, pad=False)
Encode bytes-like object b in base85 format and return a bytes object.
If pad is true, the input is padded with b'\0' so its length is a multiple of
4 bytes before encoding.
decode(input, output)
Decode a file; input and output are binary files.
decodebytes(s)
Decode a bytestring of base-64 data into a bytes object.
encode(input, output)
Encode a file; input and output are binary files.
encodebytes(s)
Encode a bytestring into a bytes object containing multiple lines
of base-64 data.
standard_b64decode(s)
Decode bytes encoded with the standard Base64 alphabet.
Argument s is a bytes-like object or ASCII string to decode. The result
is returned as a bytes object. A binascii.Error is raised if the input
is incorrectly padded. Characters that are not in the standard alphabet
are discarded prior to the padding check.
standard_b64encode(s)
Encode bytes-like object s using the standard Base64 alphabet.
The result is returned as a bytes object.
urlsafe_b64decode(s)
Decode bytes using the URL- and filesystem-safe Base64 alphabet.
Argument s is a bytes-like object or ASCII string to decode. The result
is returned as a bytes object. A binascii.Error is raised if the input
is incorrectly padded. Characters that are not in the URL-safe base-64
alphabet, and are not a plus '+' or slash '/', are discarded prior to the
padding check.
The alphabet uses '-' instead of '+' and '_' instead of '/'.
urlsafe_b64encode(s)
Encode bytes using the URL- and filesystem-safe Base64 alphabet.
Argument s is a bytes-like object to encode. The result is returned as a
bytes object. The alphabet uses '-' instead of '+' and '_' instead of
'/'.
DATA
__all__ = ['encode', 'decode', 'encodebytes', 'decodebytes', 'b64encod...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\base64.py
urllib.request.bisect
Python Library Documentation: module bisect
NAME
bisect - Bisection algorithms.
MODULE REFERENCE
https://docs.python.org/3.12/library/bisect.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.
FUNCTIONS
bisect = bisect_right(a, x, lo=0, hi=None, *, key=None)
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e <= x, and all e in
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
insert just after the rightmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
bisect_left(a, x, lo=0, hi=None, *, key=None)
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e < x, and all e in
a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
insert just before the leftmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
bisect_right(a, x, lo=0, hi=None, *, key=None)
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e <= x, and all e in
a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
insert just after the rightmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
insort = insort_right(a, x, lo=0, hi=None, *, key=None)
Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
insort_left(a, x, lo=0, hi=None, *, key=None)
Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the left of the leftmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
insort_right(a, x, lo=0, hi=None, *, key=None)
Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
A custom key function can be supplied to customize the sort order.
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\bisect.py
urllib.request.build_opener
Python Library Documentation: function build_opener in module urllib.request
build_opener(*handlers)
Create an opener object from a list of handlers.
The opener will use several default handlers, including support
for HTTP, FTP and when applicable HTTPS.
If any of the handlers passed as arguments are subclasses of the
default handlers, the default handlers will not be used.
urllib.request.contextlib
Python Library Documentation: module contextlib
NAME
contextlib - Utilities for with-statement contexts. See PEP 343.
MODULE REFERENCE
https://docs.python.org/3.12/library/contextlib.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
abc.ABC(builtins.object)
AbstractAsyncContextManager
AsyncExitStack(_BaseExitStack, AbstractAsyncContextManager)
aclosing
AbstractContextManager
ExitStack(_BaseExitStack, AbstractContextManager)
chdir
closing
nullcontext(AbstractContextManager, AbstractAsyncContextManager)
suppress
builtins.object
ContextDecorator
_BaseExitStack(builtins.object)
AsyncExitStack(_BaseExitStack, AbstractAsyncContextManager)
ExitStack(_BaseExitStack, AbstractContextManager)
_RedirectStream(AbstractContextManager)
redirect_stderr
redirect_stdout
class AbstractAsyncContextManager(abc.ABC)
| An abstract base class for asynchronous context managers.
|
| Method resolution order:
| AbstractAsyncContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| async __aenter__(self)
| Return `self` upon entering the runtime context.
|
| async __aexit__(self, exc_type, exc_value, traceback)
| Raise any exception triggered within the runtime context.
|
| ----------------------------------------------------------------------
| 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,).
|
| __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).
|
| ----------------------------------------------------------------------
| 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({'__aexit__'})
class AbstractContextManager(abc.ABC)
| An abstract base class for context managers.
|
| Method resolution order:
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, exc_type, exc_value, traceback)
| Raise any exception triggered within the runtime context.
|
| ----------------------------------------------------------------------
| 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,).
|
| __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).
|
| ----------------------------------------------------------------------
| 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({'__exit__'})
class AsyncExitStack(_BaseExitStack, AbstractAsyncContextManager)
| Async context manager for dynamic management of a stack of exit
| callbacks.
|
| For example:
| async with AsyncExitStack() as stack:
| connections = [await stack.enter_async_context(get_connection())
| for i in range(5)]
| # All opened connections will automatically be released at the
| # end of the async with statement, even if attempts to open a
| # connection later in the list raise an exception.
|
| Method resolution order:
| AsyncExitStack
| _BaseExitStack
| AbstractAsyncContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| async __aenter__(self)
| Return `self` upon entering the runtime context.
|
| async __aexit__(self, *exc_details)
| Raise any exception triggered within the runtime context.
|
| async aclose(self)
| Immediately unwind the context stack.
|
| async enter_async_context(self, cm)
| Enters the supplied async context manager.
|
| If successful, also pushes its __aexit__ method as a callback and
| returns the result of the __aenter__ method.
|
| push_async_callback(self, callback, /, *args, **kwds)
| Registers an arbitrary coroutine function and arguments.
|
| Cannot suppress exceptions.
|
| push_async_exit(self, exit)
| Registers a coroutine function with the standard __aexit__ method
| signature.
|
| Can suppress exceptions the same way __aexit__ method can.
| Also accepts any object with an __aexit__ method (registering a call
| to the method instead of the object itself).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseExitStack:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| callback(self, callback, /, *args, **kwds)
| Registers an arbitrary callback and arguments.
|
| Cannot suppress exceptions.
|
| enter_context(self, cm)
| Enters the supplied context manager.
|
| If successful, also pushes its __exit__ method as a callback and
| returns the result of the __enter__ method.
|
| pop_all(self)
| Preserve the context stack by transferring it to a new instance.
|
| push(self, exit)
| Registers a callback with the standard __exit__ method signature.
|
| Can suppress exceptions the same way __exit__ method can.
| Also accepts any object with an __exit__ method (registering a call
| to the method instead of the object itself).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _BaseExitStack:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractAsyncContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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 ContextDecorator(builtins.object)
| A base class or mixin that enables context managers to work as decorators.
|
| Methods defined here:
|
| __call__(self, func)
| Call self as a function.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class ExitStack(_BaseExitStack, AbstractContextManager)
| Context manager for dynamic management of a stack of exit callbacks.
|
| For example:
| with ExitStack() as stack:
| files = [stack.enter_context(open(fname)) for fname in filenames]
| # All opened files will automatically be closed at the end of
| # the with statement, even if attempts to open files later
| # in the list raise an exception.
|
| Method resolution order:
| ExitStack
| _BaseExitStack
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, *exc_details)
| Raise any exception triggered within the runtime context.
|
| close(self)
| Immediately unwind the context stack.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseExitStack:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| callback(self, callback, /, *args, **kwds)
| Registers an arbitrary callback and arguments.
|
| Cannot suppress exceptions.
|
| enter_context(self, cm)
| Enters the supplied context manager.
|
| If successful, also pushes its __exit__ method as a callback and
| returns the result of the __enter__ method.
|
| pop_all(self)
| Preserve the context stack by transferring it to a new instance.
|
| push(self, exit)
| Registers a callback with the standard __exit__ method signature.
|
| Can suppress exceptions the same way __exit__ method can.
| Also accepts any object with an __exit__ method (registering a call
| to the method instead of the object itself).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _BaseExitStack:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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 aclosing(AbstractAsyncContextManager)
| aclosing(thing)
|
| Async context manager for safely finalizing an asynchronously cleaned-up
| resource such as an async generator, calling its ``aclose()`` method.
|
| Code like this:
|
| async with aclosing(<module>.fetch(<arguments>)) as agen:
| <block>
|
| is equivalent to this:
|
| agen = <module>.fetch(<arguments>)
| try:
| <block>
| finally:
| await agen.aclose()
|
| Method resolution order:
| aclosing
| AbstractAsyncContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| async __aenter__(self)
| Return `self` upon entering the runtime context.
|
| async __aexit__(self, *exc_info)
| Raise any exception triggered within the runtime context.
|
| __init__(self, thing)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractAsyncContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractAsyncContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class chdir(AbstractContextManager)
| chdir(path)
|
| Non thread-safe context manager to change the current working directory.
|
| Method resolution order:
| chdir
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, *excinfo)
| Raise any exception triggered within the runtime context.
|
| __init__(self, path)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class closing(AbstractContextManager)
| closing(thing)
|
| Context to automatically close something at the end of a block.
|
| Code like this:
|
| with closing(<module>.open(<arguments>)) as f:
| <block>
|
| is equivalent to this:
|
| f = <module>.open(<arguments>)
| try:
| <block>
| finally:
| f.close()
|
| Method resolution order:
| closing
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, *exc_info)
| Raise any exception triggered within the runtime context.
|
| __init__(self, thing)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class nullcontext(AbstractContextManager, AbstractAsyncContextManager)
| nullcontext(enter_result=None)
|
| Context manager that does no additional processing.
|
| Used as a stand-in for a normal context manager, when a particular
| block of code is only sometimes used with a normal context manager:
|
| cm = optional_cm if condition else nullcontext()
| with cm:
| # Perform operation, using optional_cm if condition is True
|
| Method resolution order:
| nullcontext
| AbstractContextManager
| AbstractAsyncContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| async __aenter__(self)
| Return `self` upon entering the runtime context.
|
| async __aexit__(self, *excinfo)
| Raise any exception triggered within the runtime context.
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, *excinfo)
| Raise any exception triggered within the runtime context.
|
| __init__(self, enter_result=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class redirect_stderr(_RedirectStream)
| redirect_stderr(new_target)
|
| Context manager for temporarily redirecting stderr to another file.
|
| Method resolution order:
| redirect_stderr
| _RedirectStream
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _RedirectStream:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, exctype, excinst, exctb)
| Raise any exception triggered within the runtime context.
|
| __init__(self, new_target)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class redirect_stdout(_RedirectStream)
| redirect_stdout(new_target)
|
| Context manager for temporarily redirecting stdout to another file.
|
| # How to send help() to stderr
| with redirect_stdout(sys.stderr):
| help(dir)
|
| # How to write help() to a file
| with open('help.txt', 'w') as f:
| with redirect_stdout(f):
| help(pow)
|
| Method resolution order:
| redirect_stdout
| _RedirectStream
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _RedirectStream:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, exctype, excinst, exctb)
| Raise any exception triggered within the runtime context.
|
| __init__(self, new_target)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class suppress(AbstractContextManager)
| suppress(*exceptions)
|
| Context manager to suppress specified exceptions
|
| After the exception is suppressed, execution proceeds with the next
| statement following the with statement.
|
| with suppress(FileNotFoundError):
| os.remove(somefile)
| # Execution still resumes here if the file was already removed
|
| Method resolution order:
| suppress
| AbstractContextManager
| abc.ABC
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
| Return `self` upon entering the runtime context.
|
| __exit__(self, exctype, excinst, exctb)
| Raise any exception triggered within the runtime context.
|
| __init__(self, *exceptions)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Class methods inherited from AbstractContextManager:
|
| __class_getitem__ = GenericAlias(...)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| __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).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractContextManager:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
asynccontextmanager(func)
@asynccontextmanager decorator.
Typical usage:
@asynccontextmanager
async def some_async_generator(<arguments>):
<setup>
try:
yield <value>
finally:
<cleanup>
This makes this:
async with some_async_generator(<arguments>) as <variable>:
<body>
equivalent to this:
<setup>
try:
<variable> = <value>
<body>
finally:
<cleanup>
contextmanager(func)
@contextmanager decorator.
Typical usage:
@contextmanager
def some_generator(<arguments>):
<setup>
try:
yield <value>
finally:
<cleanup>
This makes this:
with some_generator(<arguments>) as <variable>:
<body>
equivalent to this:
<setup>
try:
<variable> = <value>
<body>
finally:
<cleanup>
DATA
__all__ = ['asynccontextmanager', 'contextmanager', 'closing', 'nullco...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\contextlib.py
urllib.request.email
Python Library Documentation: package email
NAME
email - A package for parsing, handling, and generating email messages.
MODULE REFERENCE
https://docs.python.org/3.12/library/email.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.
PACKAGE CONTENTS
_encoded_words
_header_value_parser
_parseaddr
_policybase
base64mime
charset
contentmanager
encoders
errors
feedparser
generator
header
headerregistry
iterators
message
mime (package)
parser
policy
quoprimime
utils
FUNCTIONS
message_from_binary_file(fp, *args, **kws)
Read a binary file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
message_from_bytes(s, *args, **kws)
Parse a bytes string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
message_from_file(fp, *args, **kws)
Read a file and parse its contents into a Message object model.
Optional _class and strict are passed to the Parser constructor.
message_from_string(s, *args, **kws)
Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
DATA
__all__ = ['base64mime', 'charset', 'encoders', 'errors', 'feedparser'...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\email\__init__.py
urllib.request.ftpcache
Python Library Documentation: dict object
class dict(object)
| dict() -> new empty dictionary
| dict(mapping) -> new dictionary initialized from a mapping object's
| (key, value) pairs
| dict(iterable) -> new dictionary initialized as if via:
| d = {}
| for k, v in iterable:
| d[k] = v
| dict(**kwargs) -> new dictionary initialized with the name=value pairs
| in the keyword argument list. For example: dict(one=1, two=2)
|
| Methods defined here:
|
| __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).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __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
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| 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 defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| fromkeys(iterable, value=None, /)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
urllib.request.ftperrors
Python Library Documentation: function ftperrors in module urllib.request
ftperrors()
Return the set of errors raised by the FTP class.
urllib.request.ftpwrapper
Python Library Documentation: class ftpwrapper in module urllib.request class ftpwrapper(builtins.object) | ftpwrapper(user, passwd, host, port, dirs, timeout=None, persistent=True) | | Class used by open_ftp() for cache of open FTP connections. | | Methods defined here: | | __init__(self, user, passwd, host, port, dirs, timeout=None, persistent=True) | Initialize self. See help(type(self)) for accurate signature. | | close(self) | | endtransfer(self) | | file_close(self) | | init(self) | | real_close(self) | | retrfile(self, file, type) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.request.getproxies
Python Library Documentation: function getproxies in module urllib.request
getproxies()
Return a dictionary of scheme -> proxy server URL mappings.
Returns settings gathered from the environment, if specified,
or the registry.
urllib.request.getproxies_environment
Python Library Documentation: function getproxies_environment in module urllib.request
getproxies_environment()
Return a dictionary of scheme -> proxy server URL mappings.
Scan the environment for variables named <scheme>_proxy;
this seems to be the standard convention. If you need a
different way, you can pass a proxies dictionary to the
[Fancy]URLopener constructor.
urllib.request.getproxies_registry
Python Library Documentation: function getproxies_registry in module urllib.request
getproxies_registry()
Return a dictionary of scheme -> proxy server URL mappings.
Win32 uses the registry to store proxies.
urllib.request.hashlib
Python Library Documentation: module hashlib
NAME
hashlib - hashlib module - A common interface to many hash functions.
MODULE REFERENCE
https://docs.python.org/3.12/library/hashlib.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
new(name, data=b'', **kwargs) - returns a new hash object implementing the
given hash function; initializing the hash
using the given binary data.
Named constructor functions are also available, these are faster
than using new(name):
md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(),
sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256.
More algorithms may be available on your platform but the above are guaranteed
to exist. See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().
NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.
Choose your hash function wisely. Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.
Hash objects have these methods:
- update(data): Update the hash object with the bytes in data. Repeated calls
are equivalent to a single call with the concatenation of all
the arguments.
- digest(): Return the digest of the bytes passed to the update() method
so far as a bytes object.
- hexdigest(): Like digest() except the digest is returned as a string
of double length, containing only hexadecimal digits.
- copy(): Return a copy (clone) of the hash object. This can be used to
efficiently compute the digests of datas that share a common
initial substring.
For example, to obtain the digest of the byte string 'Nobody inspects the
spammish repetition':
>>> import hashlib
>>> m = hashlib.md5()
>>> m.update(b"Nobody inspects")
>>> m.update(b" the spammish repetition")
>>> m.digest()
b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9'
More condensed:
>>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
CLASSES
builtins.object
_blake2.blake2b
_blake2.blake2s
class blake2b(builtins.object)
| blake2b(data=b'', /, *, digest_size=64, key=b'', salt=b'', person=b'', fanout=1, depth=1, leaf_size=0, node_offset=0, node_depth=0, inner_size=0, last_node=False, usedforsecurity=True)
|
| Return a new BLAKE2b hash object.
|
| Methods defined here:
|
| copy(self, /)
| Return a copy of the hash object.
|
| digest(self, /)
| Return the digest value as a bytes object.
|
| hexdigest(self, /)
| Return the digest value as a string of hexadecimal digits.
|
| update(self, data, /)
| Update this hash object's state with the provided bytes-like object.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| block_size
|
| digest_size
|
| name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MAX_DIGEST_SIZE = 64
|
| MAX_KEY_SIZE = 64
|
| PERSON_SIZE = 16
|
| SALT_SIZE = 16
class blake2s(builtins.object)
| blake2s(data=b'', /, *, digest_size=32, key=b'', salt=b'', person=b'', fanout=1, depth=1, leaf_size=0, node_offset=0, node_depth=0, inner_size=0, last_node=False, usedforsecurity=True)
|
| Return a new BLAKE2s hash object.
|
| Methods defined here:
|
| copy(self, /)
| Return a copy of the hash object.
|
| digest(self, /)
| Return the digest value as a bytes object.
|
| hexdigest(self, /)
| Return the digest value as a string of hexadecimal digits.
|
| update(self, data, /)
| Update this hash object's state with the provided bytes-like object.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| block_size
|
| digest_size
|
| name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| MAX_DIGEST_SIZE = 32
|
| MAX_KEY_SIZE = 32
|
| PERSON_SIZE = 8
|
| SALT_SIZE = 8
FUNCTIONS
file_digest(fileobj, digest, /, *, _bufsize=262144)
Hash the contents of a file-like object. Returns a digest object.
*fileobj* must be a file-like object opened for reading in binary mode.
It accepts file objects from open(), io.BytesIO(), and SocketIO objects.
The function may bypass Python's I/O and use the file descriptor *fileno*
directly.
*digest* must either be a hash algorithm name as a *str*, a hash
constructor, or a callable that returns a hash object.
md5 = openssl_md5(string=b'', *, usedforsecurity=True)
Returns a md5 hash object; optionally initialized with a string
new = __hash_new(name, data=b'', **kwargs)
new(name, data=b'') - Return a new hashing object using the named algorithm;
optionally initialized with data (which must be a bytes-like object).
pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None)
Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function.
sha1 = openssl_sha1(string=b'', *, usedforsecurity=True)
Returns a sha1 hash object; optionally initialized with a string
sha224 = openssl_sha224(string=b'', *, usedforsecurity=True)
Returns a sha224 hash object; optionally initialized with a string
sha256 = openssl_sha256(string=b'', *, usedforsecurity=True)
Returns a sha256 hash object; optionally initialized with a string
sha384 = openssl_sha384(string=b'', *, usedforsecurity=True)
Returns a sha384 hash object; optionally initialized with a string
sha3_224 = openssl_sha3_224(string=b'', *, usedforsecurity=True)
Returns a sha3-224 hash object; optionally initialized with a string
sha3_256 = openssl_sha3_256(string=b'', *, usedforsecurity=True)
Returns a sha3-256 hash object; optionally initialized with a string
sha3_384 = openssl_sha3_384(string=b'', *, usedforsecurity=True)
Returns a sha3-384 hash object; optionally initialized with a string
sha3_512 = openssl_sha3_512(string=b'', *, usedforsecurity=True)
Returns a sha3-512 hash object; optionally initialized with a string
sha512 = openssl_sha512(string=b'', *, usedforsecurity=True)
Returns a sha512 hash object; optionally initialized with a string
shake_128 = openssl_shake_128(string=b'', *, usedforsecurity=True)
Returns a shake-128 variable hash object; optionally initialized with a string
shake_256 = openssl_shake_256(string=b'', *, usedforsecurity=True)
Returns a shake-256 variable hash object; optionally initialized with a string
DATA
__all__ = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'bla...
algorithms_available = {'blake2b', 'blake2s', 'md5', 'md5-sha1', 'ripe...
algorithms_guaranteed = {'blake2b', 'blake2s', 'md5', 'sha1', 'sha224'...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\hashlib.py
urllib.request.http
Python Library Documentation: package http
NAME
http
MODULE REFERENCE
https://docs.python.org/3.12/library/http.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.
PACKAGE CONTENTS
client
cookiejar
cookies
server
CLASSES
enum.IntEnum(builtins.int, enum.ReprEnum)
HTTPStatus
enum.StrEnum(builtins.str, enum.ReprEnum)
HTTPMethod
class HTTPMethod(enum.StrEnum)
| HTTPMethod(*values)
|
| HTTP methods and descriptions
|
| Methods from the following RFCs are all observed:
|
| * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616
| * RFC 5789: PATCH Method for HTTP
|
| Method resolution order:
| HTTPMethod
| enum.StrEnum
| builtins.str
| enum.ReprEnum
| enum.Enum
| builtins.object
|
| Methods defined here:
|
| __format__(self, format_spec, /) from builtins.str
| Return a formatted version of the string as described by format_spec.
|
| __new__(cls, value) from enum.Enum
| Create and return a new object. See help(type) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self, /) from builtins.str
| Return str(self).
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CONNECT = <HTTPMethod.CONNECT>
|
| DELETE = <HTTPMethod.DELETE>
|
| GET = <HTTPMethod.GET>
|
| HEAD = <HTTPMethod.HEAD>
|
| OPTIONS = <HTTPMethod.OPTIONS>
|
| PATCH = <HTTPMethod.PATCH>
|
| POST = <HTTPMethod.POST>
|
| PUT = <HTTPMethod.PUT>
|
| TRACE = <HTTPMethod.TRACE>
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.str:
|
| __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.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __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.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __sizeof__(self, /)
| Return the size of the string in memory, in bytes.
|
| capitalize(self, /)
| Return a capitalized version of the string.
|
| More specifically, make the first character have upper case and the rest lower
| case.
|
| casefold(self, /)
| Return a version of the string suitable for caseless comparisons.
|
| center(self, width, fillchar=' ', /)
| Return a centered string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| count(...)
| S.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of substring sub in
| string S[start:end]. Optional arguments start and end are
| interpreted as in slice notation.
|
| encode(self, /, encoding='utf-8', errors='strict')
| Encode the string using the codec registered for encoding.
|
| encoding
| The encoding in which to encode the string.
| errors
| The error handling scheme to use for encoding errors.
| The default is 'strict' meaning that encoding errors raise a
| UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
| 'xmlcharrefreplace' as well as any other name registered with
| codecs.register_error that can handle UnicodeEncodeErrors.
|
| endswith(...)
| S.endswith(suffix[, start[, end]]) -> bool
|
| Return True if S ends with the specified suffix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| suffix can also be a tuple of strings to try.
|
| expandtabs(self, /, tabsize=8)
| Return a copy where all tab characters are expanded using spaces.
|
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| S.find(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| format(...)
| S.format(*args, **kwargs) -> str
|
| Return a formatted version of S, using substitutions from args and kwargs.
| The substitutions are identified by braces ('{' and '}').
|
| format_map(...)
| S.format_map(mapping) -> str
|
| Return a formatted version of S, using substitutions from mapping.
| The substitutions are identified by braces ('{' and '}').
|
| index(...)
| S.index(sub[, start[, end]]) -> int
|
| Return the lowest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| isalnum(self, /)
| Return True if the string is an alpha-numeric string, False otherwise.
|
| A string is alpha-numeric if all characters in the string are alpha-numeric and
| there is at least one character in the string.
|
| isalpha(self, /)
| Return True if the string is an alphabetic string, False otherwise.
|
| A string is alphabetic if all characters in the string are alphabetic and there
| is at least one character in the string.
|
| isascii(self, /)
| Return True if all characters in the string are ASCII, False otherwise.
|
| ASCII characters have code points in the range U+0000-U+007F.
| Empty string is ASCII too.
|
| isdecimal(self, /)
| Return True if the string is a decimal string, False otherwise.
|
| A string is a decimal string if all characters in the string are decimal and
| there is at least one character in the string.
|
| isdigit(self, /)
| Return True if the string is a digit string, False otherwise.
|
| A string is a digit string if all characters in the string are digits and there
| is at least one character in the string.
|
| isidentifier(self, /)
| Return True if the string is a valid Python identifier, False otherwise.
|
| Call keyword.iskeyword(s) to test whether string s is a reserved identifier,
| such as "def" or "class".
|
| islower(self, /)
| Return True if the string is a lowercase string, False otherwise.
|
| A string is lowercase if all cased characters in the string are lowercase and
| there is at least one cased character in the string.
|
| isnumeric(self, /)
| Return True if the string is a numeric string, False otherwise.
|
| A string is numeric if all characters in the string are numeric and there is at
| least one character in the string.
|
| isprintable(self, /)
| Return True if the string is printable, False otherwise.
|
| A string is printable if all of its characters are considered printable in
| repr() or if it is empty.
|
| isspace(self, /)
| Return True if the string is a whitespace string, False otherwise.
|
| A string is whitespace if all characters in the string are whitespace and there
| is at least one character in the string.
|
| istitle(self, /)
| Return True if the string is a title-cased string, False otherwise.
|
| In a title-cased string, upper- and title-case characters may only
| follow uncased characters and lowercase characters only cased ones.
|
| isupper(self, /)
| Return True if the string is an uppercase string, False otherwise.
|
| A string is uppercase if all cased characters in the string are uppercase and
| there is at least one cased character in the string.
|
| join(self, iterable, /)
| Concatenate any number of strings.
|
| The string whose method is called is inserted in between each given string.
| The result is returned as a new string.
|
| Example: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'
|
| ljust(self, width, fillchar=' ', /)
| Return a left-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| lower(self, /)
| Return a copy of the string converted to lowercase.
|
| lstrip(self, chars=None, /)
| Return a copy of the string with leading whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| partition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original string
| and two empty strings.
|
| removeprefix(self, prefix, /)
| Return a str with the given prefix string removed if present.
|
| If the string starts with the prefix string, return string[len(prefix):].
| Otherwise, return a copy of the original string.
|
| removesuffix(self, suffix, /)
| Return a str with the given suffix string removed if present.
|
| If the string ends with the suffix string and that suffix is not empty,
| return string[:-len(suffix)]. Otherwise, return a copy of the original
| string.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| S.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| S.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in S where substring sub is found,
| such that sub is contained within S[start:end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the substring is not found.
|
| rjust(self, width, fillchar=' ', /)
| Return a right-justified string of length width.
|
| Padding is done using the specified fill character (default is a space).
|
| rpartition(self, sep, /)
| Partition the string into three parts using the given separator.
|
| This will search for the separator in the string, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty strings
| and the original string.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the end of the string and works to the front.
|
| rstrip(self, chars=None, /)
| Return a copy of the string with trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the substrings in the string, using sep as the separator string.
|
| sep
| The separator used to split the string.
|
| When set to None (the default value), will split on any whitespace
| character (including \n \r \t \f and spaces) and will discard
| empty strings from the result.
| maxsplit
| Maximum number of splits.
| -1 (the default value) means no limit.
|
| Splitting starts at the front of the string and works to the end.
|
| Note, str.split() is mainly useful for data that has been intentionally
| delimited. With natural text that includes punctuation, consider using
| the regular expression module.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the string, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.
|
| strip(self, chars=None, /)
| Return a copy of the string with leading and trailing whitespace removed.
|
| If chars is given and not None, remove characters in chars instead.
|
| swapcase(self, /)
| Convert uppercase characters to lowercase and lowercase characters to uppercase.
|
| title(self, /)
| Return a version of the string where each word is titlecased.
|
| More specifically, words start with uppercased characters and all remaining
| cased characters have lower case.
|
| translate(self, table, /)
| Replace each character in the string using the given translation table.
|
| table
| Translation table, which must be a mapping of Unicode ordinals to
| Unicode ordinals, strings, or None.
|
| The table must implement lookup/indexing via __getitem__, for instance a
| dictionary or list. If this operation raises LookupError, the character is
| left untouched. Characters mapped to None are deleted.
|
| upper(self, /)
| Return a copy of the string converted to uppercase.
|
| zfill(self, width, /)
| Pad a numeric string with zeros on the left, to fill a field of the given width.
|
| The string is never truncated.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.str:
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| 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.
|
| ----------------------------------------------------------------------
| 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 HTTPStatus(enum.IntEnum)
| HTTPStatus(*values)
|
| HTTP status codes and reason phrases
|
| Status codes from the following RFCs are all observed:
|
| * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616
| * RFC 6585: Additional HTTP Status Codes
| * RFC 3229: Delta encoding in HTTP
| * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518
| * RFC 5842: Binding Extensions to WebDAV
| * RFC 7238: Permanent Redirect
| * RFC 2295: Transparent Content Negotiation in HTTP
| * RFC 2774: An HTTP Extension Framework
| * RFC 7725: An HTTP Status Code to Report Legal Obstacles
| * RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)
| * RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)
| * RFC 8297: An HTTP Status Code for Indicating Hints
| * RFC 8470: Using Early Data in HTTP
|
| Method resolution order:
| HTTPStatus
| 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:
|
| ACCEPTED = <HTTPStatus.ACCEPTED: 202>
|
| ALREADY_REPORTED = <HTTPStatus.ALREADY_REPORTED: 208>
|
| BAD_GATEWAY = <HTTPStatus.BAD_GATEWAY: 502>
|
| BAD_REQUEST = <HTTPStatus.BAD_REQUEST: 400>
|
| CONFLICT = <HTTPStatus.CONFLICT: 409>
|
| CONTINUE = <HTTPStatus.CONTINUE: 100>
|
| CREATED = <HTTPStatus.CREATED: 201>
|
| EARLY_HINTS = <HTTPStatus.EARLY_HINTS: 103>
|
| EXPECTATION_FAILED = <HTTPStatus.EXPECTATION_FAILED: 417>
|
| FAILED_DEPENDENCY = <HTTPStatus.FAILED_DEPENDENCY: 424>
|
| FORBIDDEN = <HTTPStatus.FORBIDDEN: 403>
|
| FOUND = <HTTPStatus.FOUND: 302>
|
| GATEWAY_TIMEOUT = <HTTPStatus.GATEWAY_TIMEOUT: 504>
|
| GONE = <HTTPStatus.GONE: 410>
|
| HTTP_VERSION_NOT_SUPPORTED = <HTTPStatus.HTTP_VERSION_NOT_SUPPORTED: 5...
|
| IM_A_TEAPOT = <HTTPStatus.IM_A_TEAPOT: 418>
|
| IM_USED = <HTTPStatus.IM_USED: 226>
|
| INSUFFICIENT_STORAGE = <HTTPStatus.INSUFFICIENT_STORAGE: 507>
|
| INTERNAL_SERVER_ERROR = <HTTPStatus.INTERNAL_SERVER_ERROR: 500>
|
| LENGTH_REQUIRED = <HTTPStatus.LENGTH_REQUIRED: 411>
|
| LOCKED = <HTTPStatus.LOCKED: 423>
|
| LOOP_DETECTED = <HTTPStatus.LOOP_DETECTED: 508>
|
| METHOD_NOT_ALLOWED = <HTTPStatus.METHOD_NOT_ALLOWED: 405>
|
| MISDIRECTED_REQUEST = <HTTPStatus.MISDIRECTED_REQUEST: 421>
|
| MOVED_PERMANENTLY = <HTTPStatus.MOVED_PERMANENTLY: 301>
|
| MULTIPLE_CHOICES = <HTTPStatus.MULTIPLE_CHOICES: 300>
|
| MULTI_STATUS = <HTTPStatus.MULTI_STATUS: 207>
|
| NETWORK_AUTHENTICATION_REQUIRED = <HTTPStatus.NETWORK_AUTHENTICATION_R...
|
| NON_AUTHORITATIVE_INFORMATION = <HTTPStatus.NON_AUTHORITATIVE_INFORMAT...
|
| NOT_ACCEPTABLE = <HTTPStatus.NOT_ACCEPTABLE: 406>
|
| NOT_EXTENDED = <HTTPStatus.NOT_EXTENDED: 510>
|
| NOT_FOUND = <HTTPStatus.NOT_FOUND: 404>
|
| NOT_IMPLEMENTED = <HTTPStatus.NOT_IMPLEMENTED: 501>
|
| NOT_MODIFIED = <HTTPStatus.NOT_MODIFIED: 304>
|
| NO_CONTENT = <HTTPStatus.NO_CONTENT: 204>
|
| OK = <HTTPStatus.OK: 200>
|
| PARTIAL_CONTENT = <HTTPStatus.PARTIAL_CONTENT: 206>
|
| PAYMENT_REQUIRED = <HTTPStatus.PAYMENT_REQUIRED: 402>
|
| PERMANENT_REDIRECT = <HTTPStatus.PERMANENT_REDIRECT: 308>
|
| PRECONDITION_FAILED = <HTTPStatus.PRECONDITION_FAILED: 412>
|
| PRECONDITION_REQUIRED = <HTTPStatus.PRECONDITION_REQUIRED: 428>
|
| PROCESSING = <HTTPStatus.PROCESSING: 102>
|
| PROXY_AUTHENTICATION_REQUIRED = <HTTPStatus.PROXY_AUTHENTICATION_REQUI...
|
| REQUESTED_RANGE_NOT_SATISFIABLE = <HTTPStatus.REQUESTED_RANGE_NOT_SATI...
|
| REQUEST_ENTITY_TOO_LARGE = <HTTPStatus.REQUEST_ENTITY_TOO_LARGE: 413>
|
| REQUEST_HEADER_FIELDS_TOO_LARGE = <HTTPStatus.REQUEST_HEADER_FIELDS_TO...
|
| REQUEST_TIMEOUT = <HTTPStatus.REQUEST_TIMEOUT: 408>
|
| REQUEST_URI_TOO_LONG = <HTTPStatus.REQUEST_URI_TOO_LONG: 414>
|
| RESET_CONTENT = <HTTPStatus.RESET_CONTENT: 205>
|
| SEE_OTHER = <HTTPStatus.SEE_OTHER: 303>
|
| SERVICE_UNAVAILABLE = <HTTPStatus.SERVICE_UNAVAILABLE: 503>
|
| SWITCHING_PROTOCOLS = <HTTPStatus.SWITCHING_PROTOCOLS: 101>
|
| TEMPORARY_REDIRECT = <HTTPStatus.TEMPORARY_REDIRECT: 307>
|
| TOO_EARLY = <HTTPStatus.TOO_EARLY: 425>
|
| TOO_MANY_REQUESTS = <HTTPStatus.TOO_MANY_REQUESTS: 429>
|
| UNAUTHORIZED = <HTTPStatus.UNAUTHORIZED: 401>
|
| UNAVAILABLE_FOR_LEGAL_REASONS = <HTTPStatus.UNAVAILABLE_FOR_LEGAL_REAS...
|
| UNPROCESSABLE_ENTITY = <HTTPStatus.UNPROCESSABLE_ENTITY: 422>
|
| UNSUPPORTED_MEDIA_TYPE = <HTTPStatus.UNSUPPORTED_MEDIA_TYPE: 415>
|
| UPGRADE_REQUIRED = <HTTPStatus.UPGRADE_REQUIRED: 426>
|
| USE_PROXY = <HTTPStatus.USE_PROXY: 305>
|
| VARIANT_ALSO_NEGOTIATES = <HTTPStatus.VARIANT_ALSO_NEGOTIATES: 506>
|
| ----------------------------------------------------------------------
| 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.
DATA
__all__ = ['HTTPStatus', 'HTTPMethod']
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\http\__init__.py
urllib.request.install_opener
Python Library Documentation: function install_opener in module urllib.request install_opener(opener)
urllib.request.io
Python Library Documentation: module io
NAME
io
MODULE REFERENCE
https://docs.python.org/3.12/library/io.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
The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.
BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.
data:
DEFAULT_BUFFER_SIZE
An int containing the default buffer size used by the module's buffered
I/O classes. open() uses the file's blksize (as obtained by os.stat) if
possible.
CLASSES
_io._BufferedIOBase(_io._IOBase)
_io.BufferedRWPair
_io.BufferedRandom
_io.BufferedReader
_io.BufferedWriter
_io.BytesIO
BufferedIOBase(_io._BufferedIOBase, IOBase)
_io._IOBase(builtins.object)
IOBase
BufferedIOBase(_io._BufferedIOBase, IOBase)
RawIOBase(_io._RawIOBase, IOBase)
TextIOBase(_io._TextIOBase, IOBase)
_io._RawIOBase(_io._IOBase)
_io.FileIO
RawIOBase(_io._RawIOBase, IOBase)
_io._TextIOBase(_io._IOBase)
_io.StringIO
_io.TextIOWrapper
TextIOBase(_io._TextIOBase, IOBase)
builtins.OSError(builtins.Exception)
builtins.BlockingIOError
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.ValueError(builtins.Exception)
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.object
_io.IncrementalNewlineDecoder
class BlockingIOError(OSError)
| I/O operation would block.
|
| Method resolution order:
| BlockingIOError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from 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 OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from 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 BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class BufferedIOBase(_io._BufferedIOBase, IOBase)
| Base class for buffered IO objects.
|
| The main difference with RawIOBase is that the read() method
| supports omitting the size argument, and does not have a default
| implementation that defers to readinto().
|
| In addition, read(), readinto() and write() may raise
| BlockingIOError if the underlying raw stream is in non-blocking
| mode and not ready; unlike their raw counterparts, they will never
| return None.
|
| A typical implementation should not inherit from a RawIOBase
| implementation, but wrap one.
|
| Method resolution order:
| BufferedIOBase
| _io._BufferedIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 BufferedRWPair(_BufferedIOBase)
| BufferedRWPair(reader, writer, buffer_size=8192, /)
|
| A buffered reader and writer object together.
|
| A buffered reader object and buffered writer object put together to
| form a sequential IO object that can read and write. This is typically
| used with a socket or two-way pipe.
|
| reader and writer are RawIOBase objects that are readable and
| writeable respectively. If the buffer_size is omitted it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRWPair
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(...)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| flush(...)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(...)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(...)
|
| read(...)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(...)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(...)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(...)
|
| readinto1(...)
|
| writable(...)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(...)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| ----------------------------------------------------------------------
| Methods inherited from _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.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedRandom(_BufferedIOBase)
| BufferedRandom(raw, buffer_size=8192)
|
| A buffered interface to random access streams.
|
| The constructor creates a reader and writer for a seekable stream,
| raw, given in the first argument. If the buffer_size is omitted it
| defaults to DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRandom
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedReader(_BufferedIOBase)
| BufferedReader(raw, buffer_size=8192)
|
| Create a new buffered reader using the given readable raw IO object.
|
| Method resolution order:
| BufferedReader
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedWriter(_BufferedIOBase)
| BufferedWriter(raw, buffer_size=8192)
|
| A buffer for a writeable sequential RawIO object.
|
| The constructor creates a BufferedWriter for the given writeable raw
| stream. If the buffer_size is not given, it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedWriter
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BytesIO(_BufferedIOBase)
| BytesIO(initial_bytes=b'')
|
| Buffered I/O implementation using an in-memory bytes buffer.
|
| Method resolution order:
| BytesIO
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| close(self, /)
| Disable all I/O operations.
|
| flush(self, /)
| Does nothing.
|
| getbuffer(self, /)
| Get a read-write view over the contents of the BytesIO object.
|
| getvalue(self, /)
| Retrieve the entire contents of the BytesIO object.
|
| isatty(self, /)
| Always returns False.
|
| BytesIO objects are not connected to a TTY-like device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| read1(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative or omitted, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readinto(self, buffer, /)
| Read bytes into buffer.
|
| Returns number of bytes read (0 for EOF), or None if the object
| is set not to block and has no data to read.
|
| readline(self, size=-1, /)
| Next line from the file, as a bytes object.
|
| Retain newline. A non-negative size argument limits the maximum
| number of bytes to return (an incomplete line may be returned then).
| Return an empty bytes object at EOF.
|
| readlines(self, size=None, /)
| List of bytes objects, each a line from the file.
|
| Call readline() repeatedly and return a list of the lines so read.
| The optional size argument, if given, is an approximate bound on the
| total number of bytes in the lines returned.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to byte offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos may be negative;
| 2 End of stream - pos usually negative.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Current file position, an integer.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is unchanged. Returns the new size.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, b, /)
| Write bytes to file.
|
| Return the number of bytes written.
|
| writelines(self, lines, /)
| Write lines to the file.
|
| Note that newlines are not added. lines can be any iterable object
| producing bytes-like objects. This is equivalent to calling write() for
| each element.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed.
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class FileIO(_RawIOBase)
| FileIO(file, mode='r', closefd=True, opener=None)
|
| Open a file.
|
| The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
| writing, exclusive creation or appending. The file will be created if it
| doesn't exist when opened for writing or appending; it will be truncated
| when opened for writing. A FileExistsError will be raised if it already
| exists when opened for creating. Opening a file for creating implies
| writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
| to allow simultaneous reading and writing. A custom opener can be used by
| passing a callable as *opener*. The underlying file descriptor for the file
| object is then obtained by calling opener with (*name*, *flags*).
| *opener* must return an open file descriptor (passing os.open as *opener*
| results in functionality similar to passing None).
|
| Method resolution order:
| FileIO
| _RawIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Close the file.
|
| A closed file cannot be used for further I/O operations. close() may be
| called more than once without error.
|
| fileno(self, /)
| Return the underlying file descriptor (an integer).
|
| isatty(self, /)
| True if the file is connected to a TTY device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as bytes.
|
| Only makes one system call, so less data may be returned than requested.
| In non-blocking mode, returns None if no data is available.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| True if file was opened in a read mode.
|
| readall(self, /)
| Read all data from the file, returned as bytes.
|
| In non-blocking mode, returns as much as is immediately available,
| or None if no data is available. Return an empty bytes object at EOF.
|
| readinto(self, buffer, /)
| Same as RawIOBase.readinto().
|
| seek(self, pos, whence=0, /)
| Move to new file position and return the file position.
|
| Argument offset is a byte count. Optional argument whence defaults to
| SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
| are SEEK_CUR or 1 (move relative to current position, positive or negative),
| and SEEK_END or 2 (move relative to end of file, usually negative, although
| many platforms allow seeking beyond the end of a file).
|
| Note that not all file objects are seekable.
|
| seekable(self, /)
| True if file supports random-access.
|
| tell(self, /)
| Current file position.
|
| Can raise OSError for non seekable files.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes and return the truncated size.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is changed to the value of size.
|
| writable(self, /)
| True if file was opened in a write mode.
|
| write(self, b, /)
| Write buffer b to file, return number of bytes written.
|
| Only makes one system call, so not all of the data may be written.
| The number of bytes actually written is returned. In non-blocking mode,
| returns None if the write would block.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed
|
| closefd
| True if the file descriptor will be closed by close().
|
| mode
| String giving the file mode
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class IOBase(_io._IOBase)
| The abstract base class for all I/O classes.
|
| This class provides dummy implementations for many methods that
| derived classes can override selectively; the default implementations
| represent a file that cannot be read, written or seeked.
|
| Even though IOBase does not declare read, readinto, or write because
| their signatures will vary, implementations and clients should
| consider those methods part of the interface. Also, implementations
| may raise UnsupportedOperation when operations they do not support are
| called.
|
| The basic type used for binary data read from or written to a file is
| bytes. Other bytes-like objects are accepted as method arguments too.
| In some cases (such as readinto), a writable object is required. Text
| I/O classes work with str data.
|
| Note that calling any method (except additional calls to close(),
| which are ignored) on a closed stream should raise a ValueError.
|
| IOBase (and its subclasses) support the iterator protocol, meaning
| that an IOBase object can be iterated over yielding the lines in a
| stream.
|
| IOBase also supports the :keyword:`with` statement. In this example,
| fp is closed after the suite of the with statement is complete:
|
| with open('spam.txt', 'r') as fp:
| fp.write('Spam and eggs!')
|
| Method resolution order:
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 IncrementalNewlineDecoder(builtins.object)
| IncrementalNewlineDecoder(decoder, translate, errors='strict')
|
| Codec used when reading a file in universal newlines mode.
|
| It wraps another incremental decoder, translating \r\n and \r into \n.
| It also records the types of newlines encountered. When used with
| translate=False, it ensures that the newline sequence is returned in
| one piece. When used with decoder=None, it expects unicode strings as
| decode input and translates newlines without first invoking an external
| decoder.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, /, input, final=False)
|
| getstate(self, /)
|
| reset(self, /)
|
| setstate(self, state, /)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| newlines
class RawIOBase(_io._RawIOBase, IOBase)
| Base class for raw binary I/O.
|
| Method resolution order:
| RawIOBase
| _io._RawIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._RawIOBase:
|
| read(self, size=-1, /)
|
| readall(self, /)
| Read until EOF, using multiple read() call.
|
| readinto(...)
|
| write(...)
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 StringIO(_TextIOBase)
| StringIO(initial_value='', newline='\n')
|
| Text I/O implementation using an in-memory buffer.
|
| The initial_value argument sets the value of object. The newline
| argument is like the one of TextIOWrapper's constructor.
|
| Method resolution order:
| StringIO
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| close(self, /)
| Close the IO object.
|
| Attempting any further operation after the object is closed
| will raise a ValueError.
|
| This method has no effect if the file is already closed.
|
| getvalue(self, /)
| Retrieve the entire contents of the object.
|
| read(self, size=-1, /)
| Read at most size characters, returned as a string.
|
| If the argument is negative or omitted, read until EOF
| is reached. Return an empty string at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Returns an empty string if EOF is hit immediately.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to character offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos must be 0;
| 2 End of stream - pos must be 0.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Tell the current file position.
|
| truncate(self, pos=None, /)
| Truncate size to pos.
|
| The pos argument defaults to the current file position, as
| returned by tell(). The current file position is unchanged.
| Returns the new absolute position.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, s, /)
| Write string to file.
|
| Returns the number of characters written, which is always equal to
| the length of the string.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| line_buffering
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(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.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class TextIOBase(_io._TextIOBase, IOBase)
| Base class for text I/O.
|
| This class provides a character and line based interface to stream
| I/O. There is no readinto method because Python's character strings
| are immutable.
|
| Method resolution order:
| TextIOBase
| _io._TextIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| write(self, s, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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.
|
| 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 TextIOWrapper(_TextIOBase)
| TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False)
|
| Character and line based layer over a BufferedIOBase object, buffer.
|
| encoding gives the name of the encoding that the stream will be
| decoded or encoded with. It defaults to locale.getencoding().
|
| errors determines the strictness of encoding and decoding (see
| help(codecs.Codec) or the documentation for codecs.register) and
| defaults to "strict".
|
| newline controls how line endings are handled. It can be None, '',
| '\n', '\r', and '\r\n'. It works as follows:
|
| * On input, if newline is None, universal newlines mode is
| enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
| these are translated into '\n' before being returned to the
| caller. If it is '', universal newline mode is enabled, but line
| endings are returned to the caller untranslated. If it has any of
| the other legal values, input lines are only terminated by the given
| string, and the line ending is returned to the caller untranslated.
|
| * On output, if newline is None, any '\n' characters written are
| translated to the system default line separator, os.linesep. If
| newline is '' or '\n', no translation takes place. If newline is any
| of the other legal values, any '\n' characters written are translated
| to the given string.
|
| If line_buffering is True, a call to flush is implied when a call to
| write contains a newline character.
|
| Method resolution order:
| TextIOWrapper
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| 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.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None)
| Reconfigure the text stream with new parameters.
|
| This also does an implicit stream flush.
|
| seek(self, cookie, whence=0, /)
| Set the stream position, and return the new stream position.
|
| cookie
| Zero or an opaque number returned by tell().
| whence
| The relative position to seek from.
|
| Four operations are supported, given by the following argument
| combinations:
|
| - seek(0, SEEK_SET): Rewind to the start of the stream.
| - seek(cookie, SEEK_SET): Restore a previous position;
| 'cookie' must be a number returned by tell().
| - seek(0, SEEK_END): Fast-forward to the end of the stream.
| - seek(0, SEEK_CUR): Leave the current stream position unchanged.
|
| Any other argument combinations are invalid,
| and may raise exceptions.
|
| 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 the stream position as an opaque number.
|
| The return value of tell() can be given as input to seek(), to restore a
| previous stream position.
|
| truncate(self, pos=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.
|
| write(self, text, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| buffer
|
| closed
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| line_buffering
|
| name
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| write_through
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class UnsupportedOperation(builtins.OSError, builtins.ValueError)
| Method resolution order:
| UnsupportedOperation
| 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 builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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
FUNCTIONS
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
dependent: locale.getencoding() is called to get the current locale encoding.
(For reading and writing raw bytes use binary mode and leave encoding
unspecified.) The available modes are:
========= ===============================================================
Character Meaning
--------- ---------------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
'a' open for writing, appending to the end of the file if it exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
========= ===============================================================
The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
line buffering (only usable in text mode), and an integer > 1 to indicate
the size of a fixed-size chunk buffer. When no buffering argument is
given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
is chosen using a heuristic trying to determine the underlying device's
"block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
On many systems, the buffer will typically be 4096 or 8192 bytes long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
* On input, if newline is None, universal newlines mode is
enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
these are translated into '\n' before being returned to the
caller. If it is '', universal newline mode is enabled, but line
endings are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
and must be True in that case.
A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
are performed. When open() is used to open a file in a text mode ('w',
'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
open_code(path)
Opens the provided file with the intent to import the contents.
This may perform extra validation beyond open(), but is otherwise interchangeable
with calling open(path, 'rb').
text_encoding(encoding, stacklevel=2, /)
A helper function to choose the text encoding.
When encoding is not None, this function returns it.
Otherwise, this function returns the default text encoding
(i.e. "locale" or "utf-8" depends on UTF-8 mode).
This function emits an EncodingWarning if encoding is None and
sys.flags.warn_default_encoding is true.
This can be used in APIs with an encoding=None parameter.
However, please consider using encoding="utf-8" for new APIs.
DATA
DEFAULT_BUFFER_SIZE = 8192
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
__all__ = ['BlockingIOError', 'open', 'open_code', 'IOBase', 'RawIOBas...
AUTHOR
Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\io.py
urllib.request.localhost
Python Library Documentation: function localhost in module urllib.request
localhost()
Return the IP address of the magic hostname 'localhost'.
urllib.request.noheaders
Python Library Documentation: function noheaders in module urllib.request
noheaders()
Return an empty email Message object.
urllib.request.os
Python Library Documentation: module os
NAME
os - OS routines for NT or Posix depending on what system we're on.
MODULE REFERENCE
https://docs.python.org/3.12/library/os.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
This exports:
- all functions from posix or nt, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix' or 'nt'
- os.curdir is a string representing the current directory (always '.')
- os.pardir is a string representing the parent directory (always '..')
- os.sep is the (or a most common) pathname separator ('/' or '\\')
- os.extsep is the extension separator (always '.')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- os.defpath is the default search path for executables
- os.devnull is the file path of the null device ('/dev/null', etc.)
Programs that import and use 'os' stand a better chance of being
portable between different platforms. Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.object
nt.DirEntry
builtins.tuple(builtins.object)
nt.times_result
nt.uname_result
stat_result
statvfs_result
terminal_size
class DirEntry(builtins.object)
| Methods defined here:
|
| __fspath__(self, /)
| Returns the path for the entry.
|
| __repr__(self, /)
| Return repr(self).
|
| inode(self, /)
| Return inode of the entry; cached per entry.
|
| is_dir(self, /, *, follow_symlinks=True)
| Return True if the entry is a directory; cached per entry.
|
| is_file(self, /, *, follow_symlinks=True)
| Return True if the entry is a file; cached per entry.
|
| is_junction(self, /)
| Return True if the entry is a junction; cached per entry.
|
| is_symlink(self, /)
| Return True if the entry is a symbolic link; cached per entry.
|
| stat(self, /, *, follow_symlinks=True)
| Return stat_result object for the entry; cached per entry.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
| the entry's base filename, relative to scandir() "path" argument
|
| path
| the entry's full path name; equivalent to os.path.join(scandir_path, entry.name)
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from 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 BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class stat_result(builtins.tuple)
| stat_result(iterable=(), /)
|
| stat_result: Result from stat, fstat, or lstat.
|
| This object may be accessed either as a tuple of
| (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
| or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.
|
| Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev,
| or st_flags, they are available as attributes only.
|
| See os.stat for more information.
|
| Method resolution order:
| stat_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| st_atime
| time of last access
|
| st_atime_ns
| time of last access in nanoseconds
|
| st_birthtime
| time of creation
|
| st_birthtime_ns
| time of creation in nanoseconds
|
| st_ctime
| time of last change
|
| st_ctime_ns
| time of last change in nanoseconds
|
| st_dev
| device
|
| st_file_attributes
| Windows file attribute bits
|
| st_gid
| group ID of owner
|
| st_ino
| inode
|
| st_mode
| protection bits
|
| st_mtime
| time of last modification
|
| st_mtime_ns
| time of last modification in nanoseconds
|
| st_nlink
| number of hard links
|
| st_reparse_tag
| Windows reparse tag
|
| st_size
| total size, in bytes
|
| st_uid
| user ID of owner
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid',...
|
| n_fields = 20
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 3
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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 statvfs_result(builtins.tuple)
| statvfs_result(iterable=(), /)
|
| statvfs_result: Result from statvfs or fstatvfs.
|
| This object may be accessed either as a tuple of
| (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),
| or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.
|
| See os.statvfs for more information.
|
| Method resolution order:
| statvfs_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| f_bavail
|
| f_bfree
|
| f_blocks
|
| f_bsize
|
| f_favail
|
| f_ffree
|
| f_files
|
| f_flag
|
| f_frsize
|
| f_fsid
|
| f_namemax
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bav...
|
| n_fields = 11
|
| n_sequence_fields = 10
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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 terminal_size(builtins.tuple)
| terminal_size(iterable=(), /)
|
| A tuple of (columns, lines) for holding terminal window size
|
| Method resolution order:
| terminal_size
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| columns
| width of the terminal window in characters
|
| lines
| height of the terminal window in characters
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('columns', 'lines')
|
| n_fields = 2
|
| n_sequence_fields = 2
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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 times_result(builtins.tuple)
| times_result(iterable=(), /)
|
| times_result: Result from os.times().
|
| This object may be accessed either as a tuple of
| (user, system, children_user, children_system, elapsed),
| or via the attributes user, system, children_user, children_system,
| and elapsed.
|
| See os.times for more information.
|
| Method resolution order:
| times_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| children_system
| system time of children
|
| children_user
| user time of children
|
| elapsed
| elapsed time since an arbitrary point in the past
|
| system
| system time
|
| user
| user time
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('user', 'system', 'children_user', 'children_system'...
|
| n_fields = 5
|
| n_sequence_fields = 5
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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 uname_result(builtins.tuple)
| uname_result(iterable=(), /)
|
| uname_result: Result from os.uname().
|
| This object may be accessed either as a tuple of
| (sysname, nodename, release, version, machine),
| or via the attributes sysname, nodename, release, version, and machine.
|
| See os.uname for more information.
|
| Method resolution order:
| uname_result
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| machine
| hardware identifier
|
| nodename
| name of machine on network (implementation-defined)
|
| release
| operating system release
|
| sysname
| operating system name
|
| version
| operating system version
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('sysname', 'nodename', 'release', 'version', 'machin...
|
| n_fields = 5
|
| n_sequence_fields = 5
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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
FUNCTIONS
_exit(status)
Exit to the system with specified status, without normal exit processing.
abort()
Abort the interpreter immediately.
This function 'dumps core' or otherwise fails in the hardest way possible
on the hosting operating system. This function never returns.
access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
Use the real uid/gid to test for access to a path.
path
Path to be tested; can be string, bytes, or a path-like object.
mode
Operating-system mode bitfield. Can be F_OK to test existence,
or the inclusive-OR of R_OK, W_OK, and X_OK.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that
directory.
effective_ids
If True, access will use the effective uid/gid instead of
the real uid/gid.
follow_symlinks
If False, and the last element of the path is a symbolic link,
access will examine the symbolic link itself instead of the file
the link points to.
dir_fd, effective_ids, and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
Note that most operations will use the effective uid/gid, therefore this
routine can be used in a suid/sgid environment to test if the invoking user
has the specified access to the path.
chdir(path)
Change the current working directory to the specified path.
path may always be specified as a string.
On some platforms, path may also be specified as an open file descriptor.
If this functionality is unavailable, using it raises an exception.
chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
Change the access permissions of a file.
path
Path to be modified. May always be specified as a str, bytes, or a path-like object.
On some platforms, path may also be specified as an open file descriptor.
If this functionality is unavailable, using it raises an exception.
mode
Operating-system mode bitfield.
Be careful when using number literals for *mode*. The conventional UNIX notation for
numeric modes uses an octal base, which needs to be indicated with a ``0o`` prefix in
Python.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that
directory.
follow_symlinks
If False, and the last element of the path is a symbolic link,
chmod will modify the symbolic link itself instead of the file
the link points to.
It is an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
dir_fd and follow_symlinks may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
close(fd)
Close a file descriptor.
closerange(fd_low, fd_high, /)
Closes all file descriptors in [fd_low, fd_high), ignoring errors.
cpu_count()
Return the number of CPUs in the system; return None if indeterminable.
This number is not equivalent to the number of CPUs the current process can
use. The number of usable CPUs can be obtained with
``len(os.sched_getaffinity(0))``
device_encoding(fd)
Return a string describing the encoding of a terminal's file descriptor.
The file descriptor must be attached to a terminal.
If the device is not a terminal, return None.
dup(fd, /)
Return a duplicate of a file descriptor.
dup2(fd, fd2, inheritable=True)
Duplicate file descriptor.
execl(file, *args)
execl(file, *args)
Execute the executable file with argument list args, replacing the
current process.
execle(file, *args)
execle(file, *args, env)
Execute the executable file with argument list args and
environment env, replacing the current process.
execlp(file, *args)
execlp(file, *args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
execlpe(file, *args)
execlpe(file, *args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the current
process.
execv(path, argv, /)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
execve(path, argv, env)
Execute an executable path with arguments, replacing current process.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
execvp(file, args)
execvp(file, args)
Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
args may be a list or tuple of strings.
execvpe(file, args, env)
execvpe(file, args, env)
Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the
current process.
args may be a list or tuple of strings.
fdopen(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)
fsdecode(filename)
Decode filename (an os.PathLike, bytes, or str) from the filesystem
encoding with 'surrogateescape' error handler, return str unchanged. On
Windows, use 'strict' error handler if the file system encoding is
'mbcs' (which is the default encoding).
fsencode(filename)
Encode filename (an os.PathLike, bytes, or str) to the filesystem
encoding with 'surrogateescape' error handler, return bytes unchanged.
On Windows, use 'strict' error handler if the file system encoding is
'mbcs' (which is the default encoding).
fspath(path)
Return the file system path representation of the object.
If the object is str or bytes, then allow it to pass through as-is. If the
object defines __fspath__(), then return the result of that method. All other
types raise a TypeError.
fstat(fd)
Perform a stat system call on the given file descriptor.
Like stat(), but for an open file descriptor.
Equivalent to os.stat(fd).
fsync(fd)
Force write of fd to disk.
ftruncate(fd, length, /)
Truncate a file, specified by file descriptor, to a specific length.
get_blocking(fd, /)
Get the blocking mode of the file descriptor.
Return False if the O_NONBLOCK flag is set, True if the flag is cleared.
get_exec_path(env=None)
Returns the sequence of directories that will be searched for the
named executable (similar to a shell) when launching a process.
*env* must be an environment variable dict or None. If *env* is None,
os.environ will be used.
get_handle_inheritable(handle, /)
Get the close-on-exe flag of the specified file descriptor.
get_inheritable(fd, /)
Get the close-on-exe flag of the specified file descriptor.
get_terminal_size(...)
Return the size of the terminal window as (columns, lines).
The optional argument fd (default standard output) specifies
which file descriptor should be queried.
If the file descriptor is not connected to a terminal, an OSError
is thrown.
This function will only be defined if an implementation is
available for this system.
shutil.get_terminal_size is the high-level function which should
normally be used, os.get_terminal_size is the low-level implementation.
getcwd()
Return a unicode string representing the current working directory.
getcwdb()
Return a bytes string representing the current working directory.
getenv(key, default=None)
Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default.
key, default and the result are str.
getlogin()
Return the actual login name.
getpid()
Return the current process id.
getppid()
Return the parent's process id.
If the parent process has already exited, Windows machines will still
return its id; others systems will return the id of the 'init' process (1).
isatty(fd, /)
Return True if the fd is connected to a terminal.
Return True if the file descriptor is an open file descriptor
connected to the slave end of a terminal.
kill(pid, signal, /)
Kill a process with a signal.
link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
Create a hard link to a file.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
If follow_symlinks is False, and the last element of src is a symbolic
link, link will create a link to the symbolic link itself instead of the
file the link points to.
src_dir_fd, dst_dir_fd, and follow_symlinks may not be implemented on your
platform. If they are unavailable, using them will raise a
NotImplementedError.
listdir(path=None)
Return a list containing the names of the files in the directory.
path can be specified as either str, bytes, or a path-like object. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.
On some platforms, path may also be specified as an open file descriptor;\
the file descriptor must refer to a directory.
If this functionality is unavailable, using it raises NotImplementedError.
The list is in arbitrary order. It does not include the special
entries '.' and '..' even if they are present in the directory.
listdrives()
Return a list containing the names of drives in the system.
A drive name typically looks like 'C:\\'.
listmounts(volume)
Return a list containing mount points for a particular volume.
'volume' should be a GUID path as returned from os.listvolumes.
listvolumes()
Return a list containing the volumes in the system.
Volumes are typically represented as a GUID path.
lseek(fd, position, whence, /)
Set the position of a file descriptor. Return the new position.
fd
An open file descriptor, as returned by os.open().
position
Position, interpreted relative to 'whence'.
whence
The relative position to seek from. Valid values are:
- SEEK_SET: seek from the start of the file.
- SEEK_CUR: seek from the current file position.
- SEEK_END: seek from the end of the file.
The return value is the number of bytes relative to the beginning of the file.
lstat(path, *, dir_fd=None)
Perform a stat system call on the given path, without following symbolic links.
Like stat(), but do not follow symbolic links.
Equivalent to stat(path, follow_symlinks=False).
makedirs(name, mode=511, exist_ok=False)
makedirs(name [, mode=0o777][, exist_ok=False])
Super-mkdir; create a leaf directory and all intermediate ones. Works like
mkdir, except that any intermediate path segment (not just the rightmost)
will be created if it does not exist. If the target directory already
exists, raise an OSError if exist_ok is False. Otherwise no exception is
raised. This is recursive.
mkdir(path, mode=511, *, dir_fd=None)
Create a directory.
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
The mode argument is ignored on Windows. Where it is used, the current umask
value is first masked out.
open(path, flags, mode=511, *, dir_fd=None)
Open a file for low level IO. Returns a file descriptor (integer).
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
pipe()
Create a pipe.
Returns a tuple of two file descriptors:
(read_fd, write_fd)
popen(cmd, mode='r', buffering=-1)
putenv(name, value, /)
Change or add an environment variable.
read(fd, length, /)
Read from a file descriptor. Returns a bytes object.
readlink(path, *, dir_fd=None)
Return a string representing the path to which the symbolic link points.
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform. If it is unavailable,
using it will raise a NotImplementedError.
remove(path, *, dir_fd=None)
Remove a file (same as unlink()).
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
removedirs(name)
removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.
rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
renames(old, new)
renames(old, new)
Super-rename; create directories as necessary and delete any left
empty. Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first. After the rename, directories corresponding to rightmost
path segments of the old name will be pruned until either the
whole path is consumed or a nonempty directory is found.
Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
Rename a file or directory, overwriting the destination.
If either src_dir_fd or dst_dir_fd is not None, it should be a file
descriptor open to a directory, and the respective path string (src or dst)
should be relative; the path will then be relative to that directory.
src_dir_fd and dst_dir_fd, may not be implemented on your platform.
If they are unavailable, using them will raise a NotImplementedError.
rmdir(path, *, dir_fd=None)
Remove a directory.
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
scandir(path=None)
Return an iterator of DirEntry objects for given path.
path can be specified as either str, bytes, or a path-like object. If path
is bytes, the names of yielded DirEntry objects will also be bytes; in
all other circumstances they will be str.
If path is None, uses the path='.'.
set_blocking(fd, blocking, /)
Set the blocking mode of the specified file descriptor.
Set the O_NONBLOCK flag if blocking is False,
clear the O_NONBLOCK flag otherwise.
set_handle_inheritable(handle, inheritable, /)
Set the inheritable flag of the specified handle.
set_inheritable(fd, inheritable, /)
Set the inheritable flag of the specified file descriptor.
spawnl(mode, file, *args)
spawnl(mode, file, *args) -> integer
Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it.
spawnle(mode, file, *args)
spawnle(mode, file, *args, env) -> integer
Execute file with arguments from args in a subprocess with the
supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it.
spawnv(mode, path, argv, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
spawnve(mode, path, argv, env, /)
Execute the program specified by path in a new process.
mode
Mode of process creation.
path
Path of executable file.
argv
Tuple or list of strings.
env
Dictionary of strings mapping to strings.
startfile(...)
Start a file with its associated application.
When "operation" is not specified or "open", this acts like
double-clicking the file in Explorer, or giving the file name as an
argument to the DOS "start" command: the file is opened with whatever
application (if any) its extension is associated.
When another "operation" is given, it specifies what should be done with
the file. A typical operation is "print".
"arguments" is passed to the application, but should be omitted if the
file is a document.
"cwd" is the working directory for the operation. If "filepath" is
relative, it will be resolved against this directory. This argument
should usually be an absolute path.
"show_cmd" can be used to override the recommended visibility option.
See the Windows ShellExecute documentation for values.
startfile returns as soon as the associated application is launched.
There is no option to wait for the application to close, and no way
to retrieve the application's exit status.
The filepath is relative to the current directory. If you want to use
an absolute path, make sure the first character is not a slash ("/");
the underlying Win32 ShellExecute function doesn't work if it is.
stat(path, *, dir_fd=None, follow_symlinks=True)
Perform a stat system call on the given path.
path
Path to be examined; can be string, bytes, a path-like object or
open-file-descriptor int.
dir_fd
If not None, it should be a file descriptor open to a directory,
and path should be a relative string; path will then be relative to
that directory.
follow_symlinks
If False, and the last element of the path is a symbolic link,
stat will examine the symbolic link itself instead of the file
the link points to.
dir_fd and follow_symlinks may not be implemented
on your platform. If they are unavailable, using them will raise a
NotImplementedError.
It's an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
strerror(code, /)
Translate an error code to a message string.
symlink(src, dst, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to src named dst.
target_is_directory is required on Windows if the target is to be
interpreted as a directory. (On Windows, symlink requires
Windows 6.0 or greater, and raises a NotImplementedError otherwise.)
target_is_directory is ignored on non-Windows platforms.
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
system(command)
Execute the command in a subshell.
times()
Return a collection containing process timing information.
The object returned behaves like a named tuple with these fields:
(utime, stime, cutime, cstime, elapsed_time)
All fields are floating-point numbers.
truncate(path, length)
Truncate a file, specified by path, to a specific length.
On some platforms, path may also be specified as an open file descriptor.
If this functionality is unavailable, using it raises an exception.
umask(mask, /)
Set the current numeric umask and return the previous umask.
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.
unsetenv(name, /)
Delete an environment variable.
urandom(size, /)
Return a bytes object containing random bytes suitable for cryptographic use.
utime(...)
Set the access and modified time of path.
path may always be specified as a string.
On some platforms, path may also be specified as an open file descriptor.
If this functionality is unavailable, using it raises an exception.
If times is not None, it must be a tuple (atime, mtime);
atime and mtime should be expressed as float seconds since the epoch.
If ns is specified, it must be a tuple (atime_ns, mtime_ns);
atime_ns and mtime_ns should be expressed as integer nanoseconds
since the epoch.
If times is None and ns is unspecified, utime uses the current time.
Specifying tuples for both times and ns is an error.
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
If follow_symlinks is False, and the last element of the path is a symbolic
link, utime will modify the symbolic link itself instead of the file the
link points to.
It is an error to use dir_fd or follow_symlinks when specifying path
as an open file descriptor.
dir_fd and follow_symlinks may not be available on your platform.
If they are unavailable, using them will raise a NotImplementedError.
waitpid(pid, options, /)
Wait for completion of a given process.
Returns a tuple of information regarding the process:
(pid, status << 8)
The options argument is ignored on Windows.
waitstatus_to_exitcode(status)
Convert a wait status to an exit code.
On Unix:
* If WIFEXITED(status) is true, return WEXITSTATUS(status).
* If WIFSIGNALED(status) is true, return -WTERMSIG(status).
* Otherwise, raise a ValueError.
On Windows, return status shifted right by 8 bits.
On Unix, if the process is being traced or if waitpid() was called with
WUNTRACED option, the caller must first check if WIFSTOPPED(status) is true.
This function must not be called if WIFSTOPPED(status) is true.
walk(top, topdown=True, onerror=None, followlinks=False)
Directory tree generator.
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (including symlinks to directories,
and excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).
If optional arg 'topdown' is true or not specified, the triple for a
directory is generated before the triples for any of its subdirectories
(directories are generated top down). If topdown is false, the triple
for a directory is generated after the triples for all of its
subdirectories (directories are generated bottom up).
When topdown is true, the caller can modify the dirnames list in-place
(e.g., via del or slice assignment), and walk will only recurse into the
subdirectories whose names remain in dirnames; this can be used to prune the
search, or to impose a specific order of visiting. Modifying dirnames when
topdown is false has no effect on the behavior of os.walk(), since the
directories in dirnames have already been generated by the time dirnames
itself is generated. No matter the value of topdown, the list of
subdirectories is retrieved before the tuples for the directory and its
subdirectories are generated.
By default errors from the os.scandir() call are ignored. If
optional arg 'onerror' is specified, it should be a function; it
will be called with one argument, an OSError instance. It can
report the error to continue with the walk, or raise the exception
to abort the walk. Note that the filename is available as the
filename attribute of the exception object.
By default, os.walk does not follow symbolic links to subdirectories on
systems that support them. In order to get this functionality, set the
optional argument 'followlinks' to true.
Caution: if you pass a relative pathname for top, don't change the
current working directory between resumptions of walk. walk never
changes the current directory, and assumes that the client doesn't
either.
Example:
import os
from os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print(root, "consumes ")
print(sum(getsize(join(root, name)) for name in files), end=" ")
print("bytes in", len(files), "non-directory files")
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
write(fd, data, /)
Write a bytes object to a file descriptor.
DATA
EX_OK = 0
F_OK = 0
O_APPEND = 8
O_BINARY = 32768
O_CREAT = 256
O_EXCL = 1024
O_NOINHERIT = 128
O_RANDOM = 16
O_RDONLY = 0
O_RDWR = 2
O_SEQUENTIAL = 32
O_SHORT_LIVED = 4096
O_TEMPORARY = 64
O_TEXT = 16384
O_TRUNC = 512
O_WRONLY = 1
P_DETACH = 4
P_NOWAIT = 1
P_NOWAITO = 3
P_OVERLAY = 2
P_WAIT = 0
R_OK = 4
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
TMP_MAX = 2147483647
W_OK = 2
X_OK = 1
__all__ = ['altsep', 'curdir', 'pardir', 'sep', 'pathsep', 'linesep', ...
altsep = '/'
curdir = '.'
defpath = r'.;C:\bin'
devnull = 'nul'
environ = environ({'ALLUSERSPROFILE': 'C:\\ProgramData', '...undled\\l...
extsep = '.'
linesep = '\r\n'
name = 'nt'
pardir = '..'
pathsep = ';'
sep = r'\'
supports_bytes_environ = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\os.py
urllib.request.parse_http_list
Python Library Documentation: function parse_http_list in module urllib.request
parse_http_list(s)
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. Neither commas nor quotes count if they are escaped.
Only double-quotes count, not single-quotes.
urllib.request.parse_keqv_list
Python Library Documentation: function parse_keqv_list in module urllib.request
parse_keqv_list(l)
Parse list of key=value strings where keys are not duplicated.
urllib.request.pathname2url
Python Library Documentation: function pathname2url in module nturl2path
pathname2url(p)
OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.
urllib.request.proxy_bypass
Python Library Documentation: function proxy_bypass in module urllib.request
proxy_bypass(host)
Return True, if host should be bypassed.
Checks proxy settings gathered from the environment, if specified,
or the registry.
urllib.request.proxy_bypass_environment
Python Library Documentation: function proxy_bypass_environment in module urllib.request
proxy_bypass_environment(host, proxies=None)
Test if proxies should not be used for a particular host.
Checks the proxy dict for the value of no_proxy, which should
be a list of comma separated DNS suffixes, or '*' for all hosts.
urllib.request.proxy_bypass_registry
Python Library Documentation: function proxy_bypass_registry in module urllib.request proxy_bypass_registry(host)
urllib.request.quote
Python Library Documentation: function quote in module urllib.parse
quote(string, safe='/', encoding=None, errors=None)
quote('abc def') -> 'abc%20def'
Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted. The
quote function offers a cautious (not minimal) way to quote a
string for most of these parts.
RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists
the following (un)reserved characters.
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Each of the reserved characters is reserved in some component of a URL,
but not necessarily in all of them.
The quote function %-escapes all characters that are neither in the
unreserved chars ("always safe") nor the additional chars set via the
safe arg.
The default for the safe arg is '/'. The character is reserved, but in
typical usage the quote function is being called on a path where the
existing slash characters are to be preserved.
Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings.
Now, "~" is included in the set of unreserved characters.
string and safe may be either str or bytes objects. encoding and errors
must not be specified if string is a bytes object.
The optional encoding and errors parameters specify how to deal with
non-ASCII characters, as accepted by the str.encode method.
By default, encoding='utf-8' (characters are encoded with UTF-8), and
errors='strict' (unsupported characters raise a UnicodeEncodeError).
urllib.request.re
Python Library Documentation: package re
NAME
re - Support for regular expressions (RE).
MODULE REFERENCE
https://docs.python.org/3.12/library/re.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
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?aiLmsux) The letters set the corresponding flags defined below.
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
The special sequences consist of "\\" and a character from the list
below. If the ordinary character is not on the list, then the
resulting RE will match the second character.
\number Matches the contents of the group of the same number.
\A Matches only at the start of the string.
\Z Matches only at the end of the string.
\b Matches the empty string, but only at the start or end of a word.
\B Matches the empty string, but not at the start or end of a word.
\d Matches any decimal digit; equivalent to the set [0-9] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode digits.
\D Matches any non-digit character; equivalent to [^\d].
\s Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode whitespace characters.
\S Matches any non-whitespace character; equivalent to [^\s].
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the
range of Unicode alphanumeric characters (letters plus digits
plus underscore).
With LOCALE, it will match the set [0-9_] plus characters defined
as letters for the current locale.
\W Matches the complement of \w.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern to the beginning of a string.
fullmatch Match a regular expression pattern to all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string.
subn Same as sub, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a Match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics in a string.
Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
A ASCII For string patterns, make \w, \W, \b, \B, \d, \D
match the corresponding ASCII character categories
(rather than the whole Unicode categories, which is the
default).
For bytes patterns, this flag is the only available
behaviour and needn't be specified.
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE For compatibility only. Ignored for string patterns (it
is the default), and forbidden for bytes patterns.
This module also defines an exception 'error'.
PACKAGE CONTENTS
_casefix
_compiler
_constants
_parser
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
Match
Pattern
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
RegexFlag
class Match(builtins.object)
| The result of re.match() and re.search().
| Match objects always have a boolean value of True.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __getitem__(self, key, /)
| Return self[key].
|
| __repr__(self, /)
| Return repr(self).
|
| end(self, group=0, /)
| Return index of the end of the substring matched by group.
|
| expand(self, /, template)
| Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
|
| group(...)
| group([group1, ...]) -> str or tuple.
| Return subgroup(s) of the match by indices or names.
| For 0 returns the entire match.
|
| groupdict(self, /, default=None)
| Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
|
| default
| Is used for groups that did not participate in the match.
|
| groups(self, /, default=None)
| Return a tuple containing all the subgroups of the match, from 1.
|
| default
| Is used for groups that did not participate in the match.
|
| span(self, group=0, /)
| For match object m, return the 2-tuple (m.start(group), m.end(group)).
|
| start(self, group=0, /)
| Return index of the start of the substring matched by group.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| endpos
| The index into the string beyond which the RE engine will not go.
|
| lastgroup
| The name of the last matched capturing group.
|
| lastindex
| The integer index of the last matched capturing group.
|
| pos
| The index into the string at which the RE engine started looking for a match.
|
| re
| The regular expression object.
|
| regs
|
| string
| The string passed to match() or search().
class Pattern(builtins.object)
| Compiled regular expression object.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __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).
|
| findall(self, /, string, pos=0, endpos=9223372036854775807)
| Return a list of all non-overlapping matches of pattern in string.
|
| finditer(self, /, string, pos=0, endpos=9223372036854775807)
| Return an iterator over all non-overlapping matches for the RE pattern in string.
|
| For each match, the iterator returns a match object.
|
| fullmatch(self, /, string, pos=0, endpos=9223372036854775807)
| Matches against all of the string.
|
| match(self, /, string, pos=0, endpos=9223372036854775807)
| Matches zero or more characters at the beginning of the string.
|
| scanner(self, /, string, pos=0, endpos=9223372036854775807)
|
| search(self, /, string, pos=0, endpos=9223372036854775807)
| Scan through string looking for a match, and return a corresponding match object instance.
|
| Return None if no position in the string matches.
|
| split(self, /, string, maxsplit=0)
| Split string by the occurrences of pattern.
|
| sub(self, /, repl, string, count=0)
| Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
|
| subn(self, /, repl, string, count=0)
| Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| flags
| The regex matching flags.
|
| groupindex
| A dictionary mapping group names to group numbers.
|
| groups
| The number of capturing groups in the pattern.
|
| pattern
| The pattern string from which the RE object was compiled.
class RegexFlag(enum.IntFlag)
| RegexFlag(*values)
|
| An enumeration.
|
| Method resolution order:
| RegexFlag
| 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)
|
| __repr__ = global_flag_repr(self) from enum
| use module.flag_name instead of class.flag_name
|
| the module is the last module in case of a multi-module name
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __str__(self, /) from builtins.object
| Return str(self).
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII = re.ASCII
|
| DEBUG = re.DEBUG
|
| DOTALL = re.DOTALL
|
| IGNORECASE = re.IGNORECASE
|
| LOCALE = re.LOCALE
|
| MULTILINE = re.MULTILINE
|
| TEMPLATE = re.TEMPLATE
|
| UNICODE = re.UNICODE
|
| VERBOSE = re.VERBOSE
|
| ----------------------------------------------------------------------
| 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 error(builtins.Exception)
| error(msg, pattern=None, pos=None)
|
| Exception raised for invalid regular expressions.
|
| Attributes:
|
| msg: The unformatted error message
| pattern: The regular expression pattern
| pos: The index in the pattern where compilation failed (may be None)
| lineno: The line corresponding to pos (may be None)
| colno: The column corresponding to pos (may be None)
|
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg, pattern=None, pos=None) from re._constants.error
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| 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
FUNCTIONS
compile(pattern, flags=0)
Compile a regular expression pattern, returning a Pattern object.
escape(pattern)
Escape special characters in a string.
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a Match object.
Empty matches are included in the result.
fullmatch(pattern, string, flags=0)
Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found.
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a Match object, or None if no match was found.
purge()
Clear the regular expression caches
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning
a Match object, or None if no match was found.
split(pattern, string, maxsplit=0, flags=0)
Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. If
capturing parentheses are used in pattern, then the text of all
groups in the pattern are also returned as part of the resulting
list. If maxsplit is nonzero, at most maxsplit splits occur,
and the remainder of the string is returned as the final element
of the list.
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used.
subn(pattern, repl, string, count=0, flags=0)
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl. number is the number of
substitutions that were made. repl can be either a string or a
callable; if a string, backslash escapes in it are processed.
If it is a callable, it's passed the Match object and must
return a replacement string to be used.
template(pattern, flags=0)
Compile a template pattern, returning a Pattern object, deprecated
DATA
A = re.ASCII
ASCII = re.ASCII
DOTALL = re.DOTALL
I = re.IGNORECASE
IGNORECASE = re.IGNORECASE
L = re.LOCALE
LOCALE = re.LOCALE
M = re.MULTILINE
MULTILINE = re.MULTILINE
NOFLAG = re.NOFLAG
S = re.DOTALL
U = re.UNICODE
UNICODE = re.UNICODE
VERBOSE = re.VERBOSE
X = re.VERBOSE
__all__ = ['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'fi...
VERSION
2.2.1
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\re\__init__.py
urllib.request.request_host
Python Library Documentation: function request_host in module urllib.request
request_host(request)
Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
urllib.request.socket
Python Library Documentation: module socket
NAME
socket
MODULE REFERENCE
https://docs.python.org/3.12/library/socket.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
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.
Functions:
socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
send_fds() -- Send file descriptor to the socket.
recv_fds() -- Receive file descriptors from the socket.
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
optional source address.
create_server() -- create a TCP socket and bind it to a specified address.
[*] not available on all platforms!
Special objects:
SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported
IntEnum constants:
AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
Integer constants:
Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
CLASSES
builtins.Exception(builtins.BaseException)
builtins.OSError
builtins.TimeoutError
gaierror
herror
builtins.object
_socket.socket
socket
enum.IntEnum(builtins.int, enum.ReprEnum)
AddressFamily
SocketKind
class AddressFamily(enum.IntEnum)
| AddressFamily(*values)
|
| An enumeration.
|
| Method resolution order:
| AddressFamily
| 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:
|
| AF_APPLETALK = <AddressFamily.AF_APPLETALK: 16>
|
| AF_BLUETOOTH = <AddressFamily.AF_BLUETOOTH: 32>
|
| AF_HYPERV = <AddressFamily.AF_HYPERV: 34>
|
| AF_INET = <AddressFamily.AF_INET: 2>
|
| AF_INET6 = <AddressFamily.AF_INET6: 23>
|
| AF_IPX = <AddressFamily.AF_IPX: 6>
|
| AF_IRDA = <AddressFamily.AF_IRDA: 26>
|
| AF_LINK = <AddressFamily.AF_LINK: 33>
|
| AF_SNA = <AddressFamily.AF_SNA: 11>
|
| AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
|
| ----------------------------------------------------------------------
| 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 SocketKind(enum.IntEnum)
| SocketKind(*values)
|
| An enumeration.
|
| Method resolution order:
| SocketKind
| 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:
|
| SOCK_DGRAM = <SocketKind.SOCK_DGRAM: 2>
|
| SOCK_RAW = <SocketKind.SOCK_RAW: 3>
|
| SOCK_RDM = <SocketKind.SOCK_RDM: 4>
|
| SOCK_SEQPACKET = <SocketKind.SOCK_SEQPACKET: 5>
|
| SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
|
| ----------------------------------------------------------------------
| 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.
SocketType = class socket(builtins.object)
| socket(family=AF_INET, type=SOCK_STREAM, proto=0) -> socket object
| socket(family=-1, type=-1, proto=-1, fileno=None) -> socket object
|
| Open a socket of the given type. The family argument specifies the
| address family; it defaults to AF_INET. The type argument specifies
| whether this is a stream (SOCK_STREAM, this is the default)
| or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0,
| specifying the default protocol. Keyword arguments are accepted.
| The socket is created as non-inheritable.
|
| When a fileno is passed in, family, type and proto are auto-detected,
| unless they are explicitly set.
|
| A socket object represents one endpoint of a network connection.
|
| Methods of socket objects (keyword arguments not allowed):
|
| _accept() -- accept connection, returning new socket fd and client address
| bind(addr) -- bind the socket to a local address
| close() -- close the socket
| connect(addr) -- connect the socket to a remote address
| connect_ex(addr) -- connect, return an error code instead of an exception
| dup() -- return a new socket fd duplicated from fileno()
| fileno() -- return underlying file descriptor
| getpeername() -- return remote address [*]
| getsockname() -- return local address
| getsockopt(level, optname[, buflen]) -- get socket options
| gettimeout() -- return timeout or None
| listen([n]) -- start listening for incoming connections
| recv(buflen[, flags]) -- receive data
| recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)
| recvfrom(buflen[, flags]) -- receive data and sender's address
| recvfrom_into(buffer[, nbytes, [, flags])
| -- receive data and sender's address (into a buffer)
| sendall(data[, flags]) -- send all data
| send(data[, flags]) -- send data, may not send all of it
| sendto(data[, flags], addr) -- send data to a given address
| setblocking(bool) -- set or clear the blocking I/O flag
| getblocking() -- return True if socket is blocking, False if non-blocking
| setsockopt(level, optname, value[, optlen]) -- set socket options
| settimeout(None | float) -- set or clear the timeout
| shutdown(how) -- shut down traffic in one or both directions
|
| [*] not available on all platforms!
|
| Methods defined here:
|
| __del__(...)
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self, /)
| Return repr(self).
|
| 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]]])
|
| close(...)
| close()
|
| Close the socket. It cannot be used after this call.
|
| connect(...)
| connect(address)
|
| Connect the socket to a remote address. For IP sockets, the address
| is a pair (host, port).
|
| connect_ex(...)
| connect_ex(address) -> errno
|
| This is like connect(address), but returns an error code (the errno value)
| instead of raising an exception when an error occurs.
|
| detach(...)
| detach()
|
| 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.
|
| 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.
|
| recv(...)
| 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(...)
| 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(...)
| recvfrom(buffersize[, flags]) -> (data, address info)
|
| Like recv(buffersize, flags) but also return the sender's address info.
|
| recvfrom_into(...)
| recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
|
| Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
|
| send(...)
| 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(...)
| 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.
|
| sendto(...)
| 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).
|
| 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().
|
| shutdown(...)
| 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).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| family
| the socket family
|
| proto
| the socket protocol
|
| timeout
| the socket timeout
|
| type
| the socket type
error = class OSError(Exception)
| Base class for I/O related errors.
|
| Method resolution order:
| OSError
| Exception
| BaseException
| object
|
| Built-in subclasses:
| BlockingIOError
| ChildProcessError
| ConnectionError
| FileExistsError
| ... and 7 other subclasses
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from 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 BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class gaierror(builtins.OSError)
| Method resolution order:
| gaierror
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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 herror(builtins.OSError)
| Method resolution order:
| herror
| builtins.OSError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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 socket(_socket.socket)
| socket(family=-1, type=-1, proto=-1, fileno=None)
|
| A subclass of _socket.socket adding the makefile() method.
|
| Method resolution order:
| socket
| _socket.socket
| builtins.object
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, *args)
|
| __getstate__(self)
| Helper for pickle.
|
| __init__(self, family=-1, type=-1, proto=-1, fileno=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Wrap __repr__() to reveal the real class name and socket
| address(es).
|
| accept(self)
| accept() -> (socket object, address info)
|
| Wait for an incoming connection. Return a new socket
| representing the connection, and the address of the client.
| For IP sockets, the address info is a pair (hostaddr, port).
|
| 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.
|
| 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_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.
|
| sendfile(self, file, offset=0, count=None)
| sendfile(file[, offset[, count]]) -> sent
|
| Send a file until EOF is reached by using high-performance
| os.sendfile() and return the total number of bytes which
| were sent.
| *file* must be a regular file object opened in binary mode.
| If os.sendfile() is not available (e.g. Windows) or file is
| not a regular file socket.send() will be used instead.
| *offset* tells from where to start reading the file.
| If specified, *count* is the total number of bytes to transmit
| as opposed to sending the file until EOF is reached.
| File position is updated on return or also in case of error in
| which case file.tell() can be used to figure out the number of
| bytes which were sent.
| The socket must be of SOCK_STREAM type.
| Non-blocking sockets are not supported.
|
| set_inheritable(self, inheritable)
| Set the inheritable flag of the socket
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| family
| Read-only access to the address family for this socket.
|
| type
| Read-only access to the socket type.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __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]]])
|
| connect(...)
| connect(address)
|
| Connect the socket to a remote address. For IP sockets, the address
| is a pair (host, port).
|
| connect_ex(...)
| connect_ex(address) -> errno
|
| This is like connect(address), but returns an error code (the errno value)
| instead of raising an exception when an error occurs.
|
| 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.
|
| recv(...)
| 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(...)
| 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(...)
| recvfrom(buffersize[, flags]) -> (data, address info)
|
| Like recv(buffersize, flags) but also return the sender's address info.
|
| recvfrom_into(...)
| recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)
|
| Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info.
|
| send(...)
| 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(...)
| 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.
|
| sendto(...)
| 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).
|
| 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().
|
| shutdown(...)
| 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).
|
| ----------------------------------------------------------------------
| 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
timeout = class TimeoutError(OSError)
| Timeout expired.
|
| Method resolution order:
| TimeoutError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from 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 OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from 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 BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
FUNCTIONS
close(...)
close(integer) -> None
Close an integer socket file descriptor. This is like os.close(), but for
sockets; on some platforms os.close() won't work for socket file descriptors.
create_connection(address, timeout=<object object at 0x000001D727B38B80>, source_address=None, *, all_errors=False)
Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used. If *source_address* is set it must be a tuple of (host, port)
for the socket to bind as a source address before making the connection.
A host of '' or port 0 tells the OS to use the default. When a connection
cannot be created, raises the last error if *all_errors* is False,
and an ExceptionGroup of all errors if *all_errors* is True.
create_server(address, *, family=<AddressFamily.AF_INET: 2>, backlog=None, reuse_port=False, dualstack_ipv6=False)
Convenience function which creates a SOCK_STREAM type socket
bound to *address* (a 2-tuple (host, port)) and return the socket
object.
*family* should be either AF_INET or AF_INET6.
*backlog* is the queue size passed to socket.listen().
*reuse_port* dictates whether to use the SO_REUSEPORT socket option.
*dualstack_ipv6*: if true and the platform supports it, it will
create an AF_INET6 socket able to accept both IPv4 or IPv6
connections. When false it will explicitly disable this option on
platforms that enable it by default (e.g. Linux).
>>> with create_server(('', 8000)) as server:
... while True:
... conn, addr = server.accept()
... # handle new connection
dup(...)
dup(integer) -> integer
Duplicate an integer socket file descriptor. This is like os.dup(), but for
sockets; on some platforms os.dup() won't work for socket file descriptors.
fromfd(fd, family, type, proto=0)
fromfd(fd, family, type[, proto]) -> socket object
Create a socket object from a duplicate of the given file
descriptor. The remaining arguments are the same as for socket().
fromshare(info)
fromshare(info) -> socket object
Create a socket object from the bytes object returned by
socket.share(pid).
getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)
Resolve host and port into list of address info entries.
Translate the host/port argument into a sequence of 5-tuples that contain
all the necessary arguments for creating a socket connected to that service.
host is a domain name, a string representation of an IPv4/v6 address or
None. port is a string service name such as 'http', a numeric port number or
None. By passing None as the value of host and port, you can pass NULL to
the underlying C API.
The family, type and proto arguments can be optionally specified in order to
narrow the list of addresses returned. Passing zero as a value for each of
these arguments selects the full range of results.
getdefaulttimeout(...)
getdefaulttimeout() -> timeout
Returns the default timeout in seconds (float) for new socket objects.
A value of None indicates that new socket objects have no timeout.
When the socket module is first imported, the default is None.
getfqdn(name='')
Get fully qualified domain name from name.
An empty argument is interpreted as meaning the local host.
First the hostname returned by gethostbyaddr() is checked, then
possibly existing aliases. In case no FQDN is available and `name`
was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::',
hostname from gethostname() is returned.
gethostbyaddr(...)
gethostbyaddr(host) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
gethostbyname(...)
gethostbyname(host) -> address
Return the IP address (a string of the form '255.255.255.255') for a host.
gethostbyname_ex(...)
gethostbyname_ex(host) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
gethostname(...)
gethostname() -> string
Return the current host name.
getnameinfo(...)
getnameinfo(sockaddr, flags) --> (host, port)
Get host and port for a sockaddr.
getprotobyname(...)
getprotobyname(name) -> integer
Return the protocol number for the named protocol. (Rarely used.)
getservbyname(...)
getservbyname(servicename[, protocolname]) -> integer
Return a port number from a service name and protocol name.
The optional protocol name, if given, should be 'tcp' or 'udp',
otherwise any protocol will match.
getservbyport(...)
getservbyport(port[, protocolname]) -> string
Return the service name from a port number and protocol name.
The optional protocol name, if given, should be 'tcp' or 'udp',
otherwise any protocol will match.
has_dualstack_ipv6()
Return True if the platform supports creating a SOCK_STREAM socket
which can handle both AF_INET and AF_INET6 (IPv4 / IPv6) connections.
htonl(...)
htonl(integer) -> integer
Convert a 32-bit integer from host to network byte order.
htons(...)
htons(integer) -> integer
Convert a 16-bit unsigned integer from host to network byte order.
if_indextoname(...)
if_indextoname(if_index)
Returns the interface name corresponding to the interface index if_index.
if_nameindex(...)
if_nameindex()
Returns a list of network interface information (index, name) tuples.
if_nametoindex(...)
if_nametoindex(if_name)
Returns the interface index corresponding to the interface name if_name.
inet_aton(...)
inet_aton(string) -> bytes giving packed 32-bit IP representation
Convert an IP address in string format (123.45.67.89) to the 32-bit packed
binary format used in low-level network functions.
inet_ntoa(...)
inet_ntoa(packed_ip) -> ip_address_string
Convert an IP address from 32-bit packed binary format to string format
inet_ntop(...)
inet_ntop(af, packed_ip) -> string formatted IP address
Convert a packed IP address of the given family to string format.
inet_pton(...)
inet_pton(af, ip) -> packed IP address string
Convert an IP address from string format to a packed string suitable
for use with low-level network functions.
ntohl(...)
ntohl(integer) -> integer
Convert a 32-bit integer from network to host byte order.
ntohs(...)
ntohs(integer) -> integer
Convert a 16-bit unsigned integer from network to host byte order.
setdefaulttimeout(...)
setdefaulttimeout(timeout)
Set the default timeout in seconds (float) for new socket objects.
A value of None indicates that new socket objects have no timeout.
When the socket module is first imported, the default is None.
socketpair = _fallback_socketpair(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=0)
socketpair([family[, type[, proto]]]) -> (socket object, socket object)
Create a pair of socket objects from the sockets returned by the platform
socketpair() function.
The arguments are the same as for socket() except the default family is AF_UNIX
if defined on the platform; otherwise, the default is AF_INET.
DATA
AF_APPLETALK = <AddressFamily.AF_APPLETALK: 16>
AF_BLUETOOTH = <AddressFamily.AF_BLUETOOTH: 32>
AF_DECnet = 12
AF_HYPERV = <AddressFamily.AF_HYPERV: 34>
AF_INET = <AddressFamily.AF_INET: 2>
AF_INET6 = <AddressFamily.AF_INET6: 23>
AF_IPX = <AddressFamily.AF_IPX: 6>
AF_IRDA = <AddressFamily.AF_IRDA: 26>
AF_LINK = <AddressFamily.AF_LINK: 33>
AF_SNA = <AddressFamily.AF_SNA: 11>
AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
AI_ADDRCONFIG = <AddressInfo.AI_ADDRCONFIG: 1024>
AI_ALL = <AddressInfo.AI_ALL: 256>
AI_CANONNAME = <AddressInfo.AI_CANONNAME: 2>
AI_NUMERICHOST = <AddressInfo.AI_NUMERICHOST: 4>
AI_NUMERICSERV = <AddressInfo.AI_NUMERICSERV: 8>
AI_PASSIVE = <AddressInfo.AI_PASSIVE: 1>
AI_V4MAPPED = <AddressInfo.AI_V4MAPPED: 2048>
BDADDR_ANY = '00:00:00:00:00:00'
BDADDR_LOCAL = '00:00:00:FF:FF:FF'
BTPROTO_RFCOMM = 3
CAPI = <capsule object "_socket.CAPI">
EAI_AGAIN = 11002
EAI_BADFLAGS = 10022
EAI_FAIL = 11003
EAI_FAMILY = 10047
EAI_MEMORY = 8
EAI_NODATA = 11001
EAI_NONAME = 11001
EAI_SERVICE = 10109
EAI_SOCKTYPE = 10044
HVSOCKET_ADDRESS_FLAG_PASSTHRU = 1
HVSOCKET_CONNECTED_SUSPEND = 4
HVSOCKET_CONNECT_TIMEOUT = 1
HVSOCKET_CONNECT_TIMEOUT_MAX = 300000
HV_GUID_BROADCAST = 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'
HV_GUID_CHILDREN = '90DB8B89-0D35-4F79-8CE9-49EA0AC8B7CD'
HV_GUID_LOOPBACK = 'E0E16197-DD56-4A10-9195-5EE7A155A838'
HV_GUID_PARENT = 'A42E7CDA-D03F-480C-9CC2-A4DE20ABB878'
HV_GUID_WILDCARD = '00000000-0000-0000-0000-000000000000'
HV_GUID_ZERO = '00000000-0000-0000-0000-000000000000'
HV_PROTOCOL_RAW = 1
INADDR_ALLHOSTS_GROUP = -536870911
INADDR_ANY = 0
INADDR_BROADCAST = -1
INADDR_LOOPBACK = 2130706433
INADDR_MAX_LOCAL_GROUP = -536870657
INADDR_NONE = -1
INADDR_UNSPEC_GROUP = -536870912
IPPORT_RESERVED = 1024
IPPORT_USERRESERVED = 5000
IPPROTO_AH = 51
IPPROTO_CBT = 7
IPPROTO_DSTOPTS = 60
IPPROTO_EGP = 8
IPPROTO_ESP = 50
IPPROTO_FRAGMENT = 44
IPPROTO_GGP = 3
IPPROTO_HOPOPTS = 0
IPPROTO_ICLFXBM = 78
IPPROTO_ICMP = 1
IPPROTO_ICMPV6 = 58
IPPROTO_IDP = 22
IPPROTO_IGMP = 2
IPPROTO_IGP = 9
IPPROTO_IP = 0
IPPROTO_IPV4 = 4
IPPROTO_IPV6 = 41
IPPROTO_L2TP = 115
IPPROTO_MAX = 256
IPPROTO_ND = 77
IPPROTO_NONE = 59
IPPROTO_PGM = 113
IPPROTO_PIM = 103
IPPROTO_PUP = 12
IPPROTO_RAW = 255
IPPROTO_RDP = 27
IPPROTO_ROUTING = 43
IPPROTO_SCTP = 132
IPPROTO_ST = 5
IPPROTO_TCP = 6
IPPROTO_UDP = 17
IPV6_CHECKSUM = 26
IPV6_DONTFRAG = 14
IPV6_HOPLIMIT = 21
IPV6_HOPOPTS = 1
IPV6_JOIN_GROUP = 12
IPV6_LEAVE_GROUP = 13
IPV6_MULTICAST_HOPS = 10
IPV6_MULTICAST_IF = 9
IPV6_MULTICAST_LOOP = 11
IPV6_PKTINFO = 19
IPV6_RECVRTHDR = 38
IPV6_RECVTCLASS = 40
IPV6_RTHDR = 32
IPV6_TCLASS = 39
IPV6_UNICAST_HOPS = 4
IPV6_V6ONLY = 27
IP_ADD_MEMBERSHIP = 12
IP_ADD_SOURCE_MEMBERSHIP = 15
IP_BLOCK_SOURCE = 17
IP_DROP_MEMBERSHIP = 13
IP_DROP_SOURCE_MEMBERSHIP = 16
IP_HDRINCL = 2
IP_MULTICAST_IF = 9
IP_MULTICAST_LOOP = 11
IP_MULTICAST_TTL = 10
IP_OPTIONS = 1
IP_PKTINFO = 19
IP_RECVDSTADDR = 25
IP_RECVTOS = 40
IP_TOS = 3
IP_TTL = 4
IP_UNBLOCK_SOURCE = 18
MSG_BCAST = <MsgFlag.MSG_BCAST: 1024>
MSG_CTRUNC = <MsgFlag.MSG_CTRUNC: 512>
MSG_DONTROUTE = <MsgFlag.MSG_DONTROUTE: 4>
MSG_ERRQUEUE = <MsgFlag.MSG_ERRQUEUE: 4096>
MSG_MCAST = <MsgFlag.MSG_MCAST: 2048>
MSG_OOB = <MsgFlag.MSG_OOB: 1>
MSG_PEEK = <MsgFlag.MSG_PEEK: 2>
MSG_TRUNC = <MsgFlag.MSG_TRUNC: 256>
MSG_WAITALL = <MsgFlag.MSG_WAITALL: 8>
NI_DGRAM = 16
NI_MAXHOST = 1025
NI_MAXSERV = 32
NI_NAMEREQD = 4
NI_NOFQDN = 1
NI_NUMERICHOST = 2
NI_NUMERICSERV = 8
RCVALL_MAX = 3
RCVALL_OFF = 0
RCVALL_ON = 1
RCVALL_SOCKETLEVELONLY = 2
SHUT_RD = 0
SHUT_RDWR = 2
SHUT_WR = 1
SIO_KEEPALIVE_VALS = 2550136836
SIO_LOOPBACK_FAST_PATH = 2550136848
SIO_RCVALL = 2550136833
SOCK_DGRAM = <SocketKind.SOCK_DGRAM: 2>
SOCK_RAW = <SocketKind.SOCK_RAW: 3>
SOCK_RDM = <SocketKind.SOCK_RDM: 4>
SOCK_SEQPACKET = <SocketKind.SOCK_SEQPACKET: 5>
SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
SOL_IP = 65531
SOL_SOCKET = 65535
SOL_TCP = 6
SOL_UDP = 17
SOMAXCONN = 2147483647
SO_ACCEPTCONN = 2
SO_BROADCAST = 32
SO_DEBUG = 1
SO_DONTROUTE = 16
SO_ERROR = 4103
SO_EXCLUSIVEADDRUSE = -5
SO_KEEPALIVE = 8
SO_LINGER = 128
SO_OOBINLINE = 256
SO_RCVBUF = 4098
SO_RCVLOWAT = 4100
SO_RCVTIMEO = 4102
SO_REUSEADDR = 4
SO_SNDBUF = 4097
SO_SNDLOWAT = 4099
SO_SNDTIMEO = 4101
SO_TYPE = 4104
SO_USELOOPBACK = 64
TCP_FASTOPEN = 15
TCP_KEEPCNT = 16
TCP_KEEPIDLE = 3
TCP_KEEPINTVL = 17
TCP_MAXSEG = 4
TCP_NODELAY = 1
__all__ = ['fromfd', 'getfqdn', 'create_connection', 'create_server', ...
errorTab = {6: 'Specified event object handle is invalid.', 8: 'Insuff...
has_ipv6 = True
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\socket.py
urllib.request.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 0x000001D727B38B80>)
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
urllib.request.string
Python Library Documentation: module string
NAME
string - A collection of string constants.
MODULE REFERENCE
https://docs.python.org/3.12/library/string.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
Public module variables:
whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a string containing all ASCII decimal digits
hexdigits -- a string containing all ASCII hexadecimal digits
octdigits -- a string containing all ASCII octal digits
punctuation -- a string containing all ASCII punctuation characters
printable -- a string containing all ASCII characters considered printable
CLASSES
builtins.object
Formatter
Template
class Formatter(builtins.object)
| Methods defined here:
|
| check_unused_args(self, used_args, args, kwargs)
|
| convert_field(self, value, conversion)
|
| format(self, format_string, /, *args, **kwargs)
|
| format_field(self, value, format_spec)
|
| get_field(self, field_name, args, kwargs)
| # given a field_name, find the object it references.
| # field_name: the field being looked up, e.g. "0.name"
| # or "lookup[3]"
| # used_args: a set of which args have been used
| # args, kwargs: as passed in to vformat
|
| get_value(self, key, args, kwargs)
|
| parse(self, format_string)
| # returns an iterable that contains tuples of the form:
| # (literal_text, field_name, format_spec, conversion)
| # literal_text can be zero length
| # field_name can be None, in which case there's no
| # object to format and output
| # if field_name is not None, it is looked up, formatted
| # with format_spec and conversion and then used
|
| vformat(self, format_string, args, kwargs)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class Template(builtins.object)
| Template(template)
|
| A string class for supporting $-substitutions.
|
| Methods defined here:
|
| __init__(self, template)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_identifiers(self)
|
| is_valid(self)
|
| safe_substitute(self, mapping={}, /, **kws)
|
| substitute(self, mapping={}, /, **kws)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __init_subclass__()
| This method is called when a class is subclassed.
|
| The default implementation does nothing. It may be
| overridden to extend subclasses.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| braceidpattern = None
|
| delimiter = '$'
|
| flags = re.IGNORECASE
|
| idpattern = '(?a:[_a-z][_a-z0-9]*)'
|
| pattern = re.compile('\n \\$(?:\n ...identifie...
FUNCTIONS
capwords(s, sep=None)
capwords(s [,sep]) -> string
Split the argument into words using split, capitalize each
word using capitalize, and join the capitalized words using
join. If the optional second argument sep is absent or None,
runs of whitespace characters are replaced by a single space
and leading and trailing whitespace are removed, otherwise
sep is used to split and join the words.
DATA
__all__ = ['ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'cap...
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
whitespace = ' \t\n\r\x0b\x0c'
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\string.py
urllib.request.sys
Python Library Documentation: built-in module sys
NAME
sys
MODULE REFERENCE
https://docs.python.org/3.12/library/sys.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
This module provides access to some objects used or maintained by the
interpreter and to functions that interact strongly with the interpreter.
Dynamic objects:
argv -- command line arguments; argv[0] is the script pathname if known
path -- module search path; path[0] is the script directory, else ''
modules -- dictionary of loaded modules
displayhook -- called to show results in an interactive session
excepthook -- called to handle any uncaught exception other than SystemExit
To customize printing in an interactive session or to install a custom
top-level exception handler, assign other functions to replace these.
stdin -- standard input file object; used by input()
stdout -- standard output file object; used by print()
stderr -- standard error object; used for error messages
By assigning other file objects (or objects that behave like files)
to these, it is possible to redirect all of the interpreter's I/O.
last_exc - the last uncaught exception
Only available in an interactive session after a
traceback has been printed.
last_type -- type of last uncaught exception
last_value -- value of last uncaught exception
last_traceback -- traceback of last uncaught exception
These three are the (deprecated) legacy representation of last_exc.
Static objects:
builtin_module_names -- tuple of module names built into this interpreter
copyright -- copyright notice pertaining to this interpreter
exec_prefix -- prefix used to find the machine-specific Python library
executable -- absolute path of the executable binary of the Python interpreter
float_info -- a named tuple with information about the float implementation.
float_repr_style -- string indicating the style of repr() output for floats
hash_info -- a named tuple with information about the hash algorithm.
hexversion -- version information encoded as a single integer
implementation -- Python implementation information.
int_info -- a named tuple with information about the int implementation.
maxsize -- the largest supported length of containers.
maxunicode -- the value of the largest Unicode code point
platform -- platform identifier
prefix -- prefix used to find the Python library
thread_info -- a named tuple with information about the thread implementation.
version -- the version of this interpreter as a string
version_info -- version information as a named tuple
dllhandle -- [Windows only] integer handle of the Python DLL
winver -- [Windows only] version number of the Python DLL
_enablelegacywindowsfsencoding -- [Windows only]
__stdin__ -- the original stdin; don't touch!
__stdout__ -- the original stdout; don't touch!
__stderr__ -- the original stderr; don't touch!
__displayhook__ -- the original displayhook; don't touch!
__excepthook__ -- the original excepthook; don't touch!
Functions:
displayhook() -- print an object to the screen, and save it in builtins._
excepthook() -- print an exception and its traceback to sys.stderr
exception() -- return the current thread's active exception
exc_info() -- return information about the current thread's active exception
exit() -- exit the interpreter by raising SystemExit
getdlopenflags() -- returns flags to be used for dlopen() calls
getprofile() -- get the global profiling function
getrefcount() -- return the reference count for an object (plus one :-)
getrecursionlimit() -- return the max recursion depth for the interpreter
getsizeof() -- return the size of an object in bytes
gettrace() -- get the global debug tracing function
setdlopenflags() -- set the flags to be used for dlopen() calls
setprofile() -- set the global profiling function
setrecursionlimit() -- set the max recursion depth for the interpreter
settrace() -- set the global debug tracing function
SUBMODULES
monitoring
FUNCTIONS
__breakpointhook__ = breakpointhook(...)
breakpointhook(*args, **kws)
This hook function is called by built-in breakpoint().
__displayhook__ = displayhook(object, /)
Print an object to sys.stdout and also save it in builtins._
__excepthook__ = excepthook(exctype, value, traceback, /)
Handle an exception by displaying it with a traceback on sys.stderr.
__unraisablehook__ = unraisablehook(unraisable, /)
Handle an unraisable exception.
The unraisable argument has the following attributes:
* exc_type: Exception type.
* exc_value: Exception value, can be None.
* exc_traceback: Exception traceback, can be None.
* err_msg: Error message, can be None.
* object: Object causing the exception, can be None.
activate_stack_trampoline(backend, /)
Activate stack profiler trampoline *backend*.
addaudithook(hook)
Adds a new audit hook callback.
audit(...)
audit(event, *args)
Passes the event to any audit hooks that are attached.
breakpointhook(...)
breakpointhook(*args, **kws)
This hook function is called by built-in breakpoint().
call_tracing(func, args, /)
Call func(*args), while tracing is enabled.
The tracing state is saved, and restored afterwards. This is intended
to be called from a debugger from a checkpoint, to recursively debug
some other code.
deactivate_stack_trampoline()
Deactivate the current stack profiler trampoline backend.
If no stack profiler is activated, this function has no effect.
displayhook(object, /)
Print an object to sys.stdout and also save it in builtins._
exc_info()
Return current exception information: (type, value, traceback).
Return information about the most recent exception caught by an except
clause in the current stack frame or in an older stack frame.
excepthook(exctype, value, traceback, /)
Handle an exception by displaying it with a traceback on sys.stderr.
exception()
Return the current exception.
Return the most recent exception caught by an except clause
in the current stack frame or in an older stack frame, or None
if no such exception exists.
exit(status=None, /)
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is an integer, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
get_asyncgen_hooks()
Return the installed asynchronous generators hooks.
This returns a namedtuple of the form (firstiter, finalizer).
get_coroutine_origin_tracking_depth()
Check status of origin tracking for coroutine objects in this thread.
get_int_max_str_digits()
Return the maximum string digits limit for non-binary int<->str conversions.
getallocatedblocks()
Return the number of memory blocks currently allocated.
getdefaultencoding()
Return the current default encoding used by the Unicode implementation.
getfilesystemencodeerrors()
Return the error mode used Unicode to OS filename conversion.
getfilesystemencoding()
Return the encoding used to convert Unicode filenames to OS filenames.
getprofile()
Return the profiling function set with sys.setprofile.
See the profiler chapter in the library manual.
getrecursionlimit()
Return the current value of the recursion limit.
The recursion limit is the maximum depth of the Python interpreter
stack. This limit prevents infinite recursion from causing an overflow
of the C stack and crashing Python.
getrefcount(object, /)
Return the reference count of object.
The count returned is generally one higher than you might expect,
because it includes the (temporary) reference as an argument to
getrefcount().
getsizeof(...)
getsizeof(object [, default]) -> int
Return the size of object in bytes.
getswitchinterval()
Return the current thread switch interval; see sys.setswitchinterval().
gettrace()
Return the global debug tracing function set with sys.settrace.
See the debugger chapter in the library manual.
getunicodeinternedsize()
Return the number of elements of the unicode interned dictionary
getwindowsversion()
Return info about the running version of Windows as a named tuple.
The members are named: major, minor, build, platform, service_pack,
service_pack_major, service_pack_minor, suite_mask, product_type and
platform_version. For backward compatibility, only the first 5 items
are available by indexing. All elements are numbers, except
service_pack and platform_type which are strings, and platform_version
which is a 3-tuple. Platform is always 2. Product_type may be 1 for a
workstation, 2 for a domain controller, 3 for a server.
Platform_version is a 3-tuple containing a version number that is
intended for identifying the OS rather than feature detection.
intern(string, /)
``Intern'' the given string.
This enters the string in the (global) table of interned strings whose
purpose is to speed up dictionary lookups. Return the string itself or
the previously interned string object with the same value.
is_finalizing()
Return True if Python is exiting.
is_stack_trampoline_active()
Return *True* if a stack profiler trampoline is active.
set_asyncgen_hooks(...)
set_asyncgen_hooks([firstiter] [, finalizer])
Set a finalizer for async generators objects.
set_coroutine_origin_tracking_depth(depth)
Enable or disable origin tracking for coroutine objects in this thread.
Coroutine objects will track 'depth' frames of traceback information
about where they came from, available in their cr_origin attribute.
Set a depth of 0 to disable.
set_int_max_str_digits(maxdigits)
Set the maximum string digits limit for non-binary int<->str conversions.
setprofile(...)
setprofile(function)
Set the profiling function. It will be called on each function call
and return. See the profiler chapter in the library manual.
setrecursionlimit(limit, /)
Set the maximum depth of the Python interpreter stack to n.
This limit prevents infinite recursion from causing an overflow of the C
stack and crashing Python. The highest possible limit is platform-
dependent.
setswitchinterval(interval, /)
Set the ideal thread switching delay inside the Python interpreter.
The actual frequency of switching threads can be lower if the
interpreter executes long sequences of uninterruptible code
(this is implementation-specific and workload-dependent).
The parameter must represent the desired switching delay in seconds
A typical value is 0.005 (5 milliseconds).
settrace(...)
settrace(function)
Set the global debug tracing function. It will be called on each
function call. See the debugger chapter in the library manual.
unraisablehook(unraisable, /)
Handle an unraisable exception.
The unraisable argument has the following attributes:
* exc_type: Exception type.
* exc_value: Exception value, can be None.
* exc_traceback: Exception traceback, can be None.
* err_msg: Error message, can be None.
* object: Object causing the exception, can be None.
DATA
__stderr__ = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='cp1...
__stdin__ = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8...
__stdout__ = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1...
api_version = 1013
argv = [r'f:\JoeyCodes\PyDocs\py_docs.py', '--worker', 'urllib', r'F:\...
base_exec_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Pyth...
base_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312...
builtin_module_names = ('_abc', '_ast', '_bisect', '_blake2', '_codecs...
byteorder = 'little'
copyright = 'Copyright (c) 2001-2023 Python Software Foundati...ematis...
dllhandle = 140727031824384
dont_write_bytecode = False
exec_prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312...
executable = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312\...
flags = sys.flags(debug=0, inspect=0, interactive=0, opt...ding=0, saf...
float_info = sys.float_info(max=1.7976931348623157e+308, max_...epsilo...
float_repr_style = 'short'
hash_info = sys.hash_info(width=64, modulus=2305843009213693...iphash1...
hexversion = 51119856
implementation = namespace(name='cpython', cache_tag='cpython-312...as...
int_info = sys.int_info(bits_per_digit=30, sizeof_digit=4, ..._str_dig...
maxsize = 9223372036854775807
maxunicode = 1114111
meta_path = [<_distutils_hack.DistutilsMetaFinder object>, <class '_fr...
modules = {'__future__': <module '__future__' from 'C:\\Users\\Youse\\...
orig_argv = [r'C:\Users\Youse\AppData\Local\Programs\Python\Python312\...
path = [r'f:\JoeyCodes\PyDocs', r'C:\Users\Youse\AppData\Local\Program...
path_hooks = [<class 'zipimport.zipimporter'>, <function FileFinder.pa...
path_importer_cache = {r'C:\Users\Youse\AppData\Local\Programs\Python\...
platform = 'win32'
platlibdir = 'DLLs'
prefix = r'C:\Users\Youse\AppData\Local\Programs\Python\Python312'
pycache_prefix = None
stderr = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='cp1252'...
stdin = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>
stdlib_module_names = frozenset({'__future__', '_abc', '_aix_support',...
stdout = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'...
thread_info = sys.thread_info(name='nt', lock=None, version=None)
version = '3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v...
version_info = sys.version_info(major=3, minor=12, micro=6, releaselev...
warnoptions = []
winver = '3.12'
FILE
(built-in)
urllib.request.tempfile
Python Library Documentation: module tempfile
NAME
tempfile - Temporary files.
MODULE REFERENCE
https://docs.python.org/3.12/library/tempfile.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
This module provides generic, low- and high-level interfaces for
creating temporary files and directories. All of the interfaces
provided by this module can be used without fear of race conditions
except for 'mktemp'. 'mktemp' is subject to race conditions and
should not be used; it is provided for backward compatibility only.
The default path names are returned as str. If you supply bytes as
input, all return values will be in bytes. Ex:
>>> tempfile.mkstemp()
(4, '/tmp/tmptpu9nin8')
>>> tempfile.mkdtemp(suffix=b'')
b'/tmp/tmppbi8f0hy'
This module also provides some data items to the user:
TMP_MAX - maximum number of names that will be tried before
giving up.
tempdir - If this is set to a string before the first use of
any routine from this module, it will be considered as
another candidate location to store temporary files.
CLASSES
builtins.object
TemporaryDirectory
io.IOBase(_io._IOBase)
SpooledTemporaryFile
class SpooledTemporaryFile(io.IOBase)
| SpooledTemporaryFile(max_size=0, mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)
|
| Temporary file wrapper, specialized to switch from BytesIO
| or StringIO to a real file when it exceeds a certain size or
| when a fileno is needed.
|
| Method resolution order:
| SpooledTemporaryFile
| io.IOBase
| _io._IOBase
| builtins.object
|
| Methods defined here:
|
| __del__(self)
|
| __enter__(self)
| # Context management protocol
|
| __exit__(self, exc, value, tb)
|
| __init__(self, max_size=0, mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self)
| Implement iter(self).
|
| close(self)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(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.
|
| read(self, *args)
|
| read1(self, *args)
|
| readable(self)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, b)
|
| readinto1(self, b)
|
| readline(self, *args)
| 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, *args)
| 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.
|
| rollover(self)
|
| seek(self, *args)
| 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.
|
| write(self, s)
|
| writelines(self, iterable)
| 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.
|
| ----------------------------------------------------------------------
| 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:
|
| closed
|
| encoding
|
| errors
|
| mode
|
| name
|
| newlines
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __next__(self, /)
| Implement next(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._IOBase:
|
| __dict__
class TemporaryDirectory(builtins.object)
| TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True)
|
| Create and return a temporary directory. This has the same
| behavior as mkdtemp but can be used as a context manager. For
| example:
|
| with TemporaryDirectory() as tmpdir:
| ...
|
| Upon exiting the context, the directory and everything contained
| in it are removed (unless delete=False is passed or an exception
| is raised during cleanup and ignore_cleanup_errors is not True).
|
| Optional Arguments:
| suffix - A str suffix for the directory name. (see mkdtemp)
| prefix - A str prefix for the directory name. (see mkdtemp)
| dir - A directory to create this temp dir in. (see mkdtemp)
| ignore_cleanup_errors - False; ignore exceptions during cleanup?
| delete - True; whether the directory is automatically deleted.
|
| Methods defined here:
|
| __enter__(self)
|
| __exit__(self, exc, value, tb)
|
| __init__(self, suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, *, delete=True)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| cleanup(self)
|
| ----------------------------------------------------------------------
| 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 descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True, *, errors=None, delete_on_close=True)
Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to io.open (default "w+b").
'buffering' -- the buffer size argument to io.open (default -1).
'encoding' -- the encoding argument to io.open (default None)
'newline' -- the newline argument to io.open (default None)
'delete' -- whether the file is automatically deleted (default True).
'delete_on_close' -- if 'delete', whether the file is deleted on close
(default True) or otherwise either on context manager exit
(if context manager was used) or on object finalization. .
'errors' -- the errors argument to io.open (default None)
The file is created as mkstemp() would do it.
Returns an object with a file-like interface; the name of the file
is accessible as its 'name' attribute. The file will be automatically
deleted when it is closed unless the 'delete' argument is set to False.
On POSIX, NamedTemporaryFiles cannot be automatically deleted if
the creating process is terminated abruptly with a SIGKILL signal.
Windows can delete the file even in this case.
TemporaryFile = NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None, newline=None, suffix=None, prefix=None, dir=None, delete=True, *, errors=None, delete_on_close=True)
Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to io.open (default "w+b").
'buffering' -- the buffer size argument to io.open (default -1).
'encoding' -- the encoding argument to io.open (default None)
'newline' -- the newline argument to io.open (default None)
'delete' -- whether the file is automatically deleted (default True).
'delete_on_close' -- if 'delete', whether the file is deleted on close
(default True) or otherwise either on context manager exit
(if context manager was used) or on object finalization. .
'errors' -- the errors argument to io.open (default None)
The file is created as mkstemp() would do it.
Returns an object with a file-like interface; the name of the file
is accessible as its 'name' attribute. The file will be automatically
deleted when it is closed unless the 'delete' argument is set to False.
On POSIX, NamedTemporaryFiles cannot be automatically deleted if
the creating process is terminated abruptly with a SIGKILL signal.
Windows can delete the file even in this case.
gettempdir()
Returns tempfile.tempdir as str.
gettempdirb()
Returns tempfile.tempdir as bytes.
gettempprefix()
The default prefix for temporary directories as string.
gettempprefixb()
The default prefix for temporary directories as bytes.
mkdtemp(suffix=None, prefix=None, dir=None)
User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is responsible for deleting the directory when done with it.
mkstemp(suffix=None, prefix=None, dir=None, text=False)
User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
If 'suffix' is not None, the file name will end with that suffix,
otherwise there will be no suffix.
If 'prefix' is not None, the file name will begin with that prefix,
otherwise a default prefix is used.
If 'dir' is not None, the file will be created in that directory,
otherwise a default directory is used.
If 'text' is specified and true, the file is opened in text
mode. Else (the default) the file is opened in binary mode.
If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
same type. If they are bytes, the returned name will be bytes; str
otherwise.
The file is readable and writable only by the creating user ID.
If the operating system uses permission bits to indicate whether a
file is executable, the file is executable by no one. The file
descriptor is not inherited by children of this process.
Caller is responsible for deleting the file when done with it.
mktemp(suffix='', prefix='tmp', dir=None)
User-callable function to return a unique temporary file name. The
file is not created.
Arguments are similar to mkstemp, except that the 'text' argument is
not accepted, and suffix=None, prefix=None and bytes file names are not
supported.
THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED. The file name may
refer to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch.
DATA
TMP_MAX = 2147483647
__all__ = ['NamedTemporaryFile', 'TemporaryFile', 'SpooledTemporaryFil...
tempdir = None
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\tempfile.py
urllib.request.thishost
Python Library Documentation: function thishost in module urllib.request
thishost()
Return the IP addresses of the current host.
urllib.request.time
Python Library Documentation: built-in module time
NAME
time - This module provides various functions to manipulate time values.
DESCRIPTION
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating-point number (to represent fractions of seconds).
The epoch is the point where the time starts, the return value of time.gmtime(0).
It is January 1, 1970, 00:00:00 (UTC) on all platforms.
The other representation is a tuple of 9 integers giving local time.
The tuple items are:
year (including century, e.g. 1998)
month (1-12)
day (1-31)
hours (0-23)
minutes (0-59)
seconds (0-59)
weekday (0-6, Monday is 0)
Julian day (day in the year, 1-366)
DST (Daylight Savings Time) flag (-1, 0 or 1)
If the DST flag is 0, the time is given in the regular time zone;
if it is 1, the time is given in the DST time zone;
if it is -1, mktime() should guess based on the date and time.
CLASSES
builtins.tuple(builtins.object)
struct_time
class struct_time(builtins.tuple)
| struct_time(iterable=(), /)
|
| The time value as returned by gmtime(), localtime(), and strptime(), and
| accepted by asctime(), mktime() and strftime(). May be considered as a
| sequence of 9 integers.
|
| Note that several fields' values are not the same as those defined by
| the C language standard for struct tm. For example, the value of the
| field tm_year is the actual year, not year - 1900. See individual
| fields' descriptions for details.
|
| Method resolution order:
| struct_time
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| tm_gmtoff
| offset from UTC in seconds
|
| tm_hour
| hours, range [0, 23]
|
| tm_isdst
| 1 if summer time is in effect, 0 if not, and -1 if unknown
|
| tm_mday
| day of month, range [1, 31]
|
| tm_min
| minutes, range [0, 59]
|
| tm_mon
| month of year, range [1, 12]
|
| tm_sec
| seconds, range [0, 61])
|
| tm_wday
| day of week, range [0, 6], Monday is 0
|
| tm_yday
| day of year, range [1, 366]
|
| tm_year
| year, for example, 1993
|
| tm_zone
| abbreviation of timezone name
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('tm_year', 'tm_mon', 'tm_mday', 'tm_hour', 'tm_min',...
|
| n_fields = 11
|
| n_sequence_fields = 9
|
| n_unnamed_fields = 0
|
| ----------------------------------------------------------------------
| 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].
|
| __getnewargs__(self, /)
|
| __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
FUNCTIONS
asctime(...)
asctime([tuple]) -> string
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.
When the time tuple is not present, current time as returned by localtime()
is used.
ctime(...)
ctime(seconds) -> string
Convert a time in seconds since the Epoch to a string in local time.
This is equivalent to asctime(localtime(seconds)). When the time tuple is
not present, current time as returned by localtime() is used.
get_clock_info(...)
get_clock_info(name: str) -> dict
Get information of the specified clock.
gmtime(...)
gmtime([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 UTC (a.k.a.
GMT). When 'seconds' is not passed in, convert the current time instead.
If the platform supports the tm_gmtoff and tm_zone, they are available as
attributes only.
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.
mktime(...)
mktime(tuple) -> floating-point number
Convert a time tuple in local time to seconds since the Epoch.
Note that mktime(gmtime(0)) will not generally return zero for most
time zones; instead the returned value will either be equal to that
of the timezone or altzone attributes on the time module.
monotonic(...)
monotonic() -> float
Monotonic clock, cannot go backward.
monotonic_ns(...)
monotonic_ns() -> int
Monotonic clock, cannot go backward, as nanoseconds.
perf_counter(...)
perf_counter() -> float
Performance counter for benchmarking.
perf_counter_ns(...)
perf_counter_ns() -> int
Performance counter for benchmarking as nanoseconds.
process_time(...)
process_time() -> float
Process time for profiling: sum of the kernel and user-space CPU time.
process_time_ns(...)
process_time() -> int
Process time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
sleep(...)
sleep(seconds)
Delay execution for a given number of seconds. The argument may be
a floating-point number for subsecond precision.
strftime(...)
strftime(format[, tuple]) -> string
Convert a time tuple to a string according to a format specification.
See the library reference manual for formatting codes. When the time tuple
is not present, current time as returned by localtime() is used.
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
strptime(...)
strptime(string, format) -> struct_time
Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as
strftime()).
Commonly used format codes:
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM.
Other codes may be available on your platform. See documentation for
the C library strftime function.
thread_time(...)
thread_time() -> float
Thread time for profiling: sum of the kernel and user-space CPU time.
thread_time_ns(...)
thread_time() -> int
Thread time for profiling as nanoseconds:
sum of the kernel and user-space CPU time.
time(...)
time() -> floating-point number
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.
time_ns(...)
time_ns() -> int
Return the current time in nanoseconds since the Epoch.
DATA
altzone = -10800
daylight = 1
timezone = -7200
tzname = ('Egypt Standard Time', 'Egypt Daylight Time')
FILE
(built-in)
urllib.request.unquote
Python Library Documentation: function unquote in module urllib.parse
unquote(string, encoding='utf-8', errors='replace')
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences into Unicode characters, as accepted by the bytes.decode()
method.
By default, percent-encoded sequences are decoded with UTF-8, and invalid
sequences are replaced by a placeholder character.
unquote('abc%20def') -> 'abc def'.
urllib.request.unquote_to_bytes
Python Library Documentation: function unquote_to_bytes in module urllib.parse
unquote_to_bytes(string)
unquote_to_bytes('abc%20def') -> b'abc def'.
urllib.request.unwrap
Python Library Documentation: function unwrap in module urllib.parse
unwrap(url)
Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'.
The string is returned unchanged if it's not a wrapped URL.
urllib.request.url2pathname
Python Library Documentation: function url2pathname in module nturl2path
url2pathname(url)
OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use.
urllib.request.urlcleanup
Python Library Documentation: function urlcleanup in module urllib.request
urlcleanup()
Clean up temporary files from urlretrieve calls.
urllib.request.urljoin
Python Library Documentation: function urljoin in module urllib.parse
urljoin(base, url, allow_fragments=True)
Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
urllib.request.urlopen
Python Library Documentation: function urlopen in module urllib.request
urlopen(url, data=None, timeout=<object object at 0x000001D727B38B80>, *, cafile=None, capath=None, cadefault=False, context=None)
Open the URL url, which can be either a string or a Request object.
*data* must be an object specifying additional data to be sent to
the server, or None if no such data is needed. See Request for
details.
urllib.request module uses HTTP/1.1 and includes a "Connection:close"
header in its HTTP requests.
The optional *timeout* parameter specifies a timeout in seconds for
blocking operations like the connection attempt (if not specified, the
global default timeout setting will be used). This only works for HTTP,
HTTPS and FTP connections.
If *context* is specified, it must be a ssl.SSLContext instance describing
the various SSL options. See HTTPSConnection for more details.
The optional *cafile* and *capath* parameters specify a set of trusted CA
certificates for HTTPS requests. cafile should point to a single file
containing a bundle of CA certificates, whereas capath should point to a
directory of hashed certificate files. More information can be found in
ssl.SSLContext.load_verify_locations().
The *cadefault* parameter is ignored.
This function always returns an object which can work as a
context manager and has the properties url, headers, and status.
See urllib.response.addinfourl for more detail on these properties.
For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse
object slightly modified. In addition to the three new methods above, the
msg attribute contains the same information as the reason attribute ---
the reason phrase returned by the server --- instead of the response
headers as it is specified in the documentation for HTTPResponse.
For FTP, file, and data URLs and requests explicitly handled by legacy
URLopener and FancyURLopener classes, this function returns a
urllib.response.addinfourl object.
Note that None may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).
In addition, if proxy settings are detected (for example, when a *_proxy
environment variable like http_proxy is set), ProxyHandler is default
installed and makes sure the requests are handled through the proxy.
urllib.request.urlparse
Python Library Documentation: function urlparse in module urllib.parse
urlparse(url, scheme='', allow_fragments=True)
Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
The result is a named 6-tuple with fields corresponding to the
above. It is either a ParseResult or ParseResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urllib.request.urlretrieve
Python Library Documentation: function urlretrieve in module urllib.request
urlretrieve(url, filename=None, reporthook=None, data=None)
Retrieve a URL into a temporary location on disk.
Requires a URL argument. If a filename is passed, it is used as
the temporary file location. The reporthook argument should be
a callable that accepts a block number, a read size, and the
total file size of the URL target. The data argument should be
valid URL encoded data.
If a filename is passed and the URL points to a local resource,
the result is a copy from local file to new file.
Returns a tuple containing the path to the newly created
data file as well as the resulting HTTPMessage object.
urllib.request.urlsplit
Python Library Documentation: _lru_cache_wrapper in module urllib.parse
urlsplit(url, scheme='', allow_fragments=True)
Parse a URL into 5 components:
<scheme>://<netloc>/<path>?<query>#<fragment>
The result is a named 5-tuple with fields corresponding to the
above. It is either a SplitResult or SplitResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urllib.request.urlunparse
Python Library Documentation: function urlunparse in module urllib.parse
urlunparse(components)
Put a parsed URL back together again. This may result in a
slightly different, but equivalent URL, if the URL that was parsed
originally had redundant delimiters, e.g. a ? with an empty query
(the draft states that these are equivalent).
urllib.request.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
urllib.parse.DefragResult
Python Library Documentation: class DefragResult in module urllib.parse
class DefragResult(DefragResult, _ResultMixinStr)
| DefragResult(url, fragment)
|
| # Structured result objects for string data
|
| Method resolution order:
| DefragResult
| DefragResult
| builtins.tuple
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.DefragResultBytes'>
| # Structured result objects for bytes data
|
|
| ----------------------------------------------------------------------
| Methods inherited from DefragResult:
|
| __getnewargs__(self) from collections.DefragResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.DefragResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.DefragResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.DefragResult
| Return a new DefragResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from DefragResult:
|
| _make(iterable) from collections.DefragResult
| Make a new DefragResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from DefragResult:
|
| __new__(_cls, url, fragment) from namedtuple_DefragResult.DefragResult
| Create new instance of DefragResult(url, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DefragResult:
|
| url
| The URL with no fragment identifier.
|
| fragment
| Fragment identifier separated from URL, that allows indirect identification of a
| secondary resource by reference to a primary resource and additional identifying
| information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DefragResult:
|
| __match_args__ = ('url', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('url', 'fragment')
|
| ----------------------------------------------------------------------
| 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 _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
urllib.parse.DefragResultBytes
Python Library Documentation: class DefragResultBytes in module urllib.parse
class DefragResultBytes(DefragResult, _ResultMixinBytes)
| DefragResultBytes(url, fragment)
|
| # Structured result objects for bytes data
|
| Method resolution order:
| DefragResultBytes
| DefragResult
| builtins.tuple
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.DefragResult'>
| # Structured result objects for string data
|
|
| ----------------------------------------------------------------------
| Methods inherited from DefragResult:
|
| __getnewargs__(self) from collections.DefragResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.DefragResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.DefragResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.DefragResult
| Return a new DefragResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from DefragResult:
|
| _make(iterable) from collections.DefragResult
| Make a new DefragResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from DefragResult:
|
| __new__(_cls, url, fragment) from namedtuple_DefragResult.DefragResult
| Create new instance of DefragResult(url, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from DefragResult:
|
| url
| The URL with no fragment identifier.
|
| fragment
| Fragment identifier separated from URL, that allows indirect identification of a
| secondary resource by reference to a primary resource and additional identifying
| information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from DefragResult:
|
| __match_args__ = ('url', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('url', 'fragment')
|
| ----------------------------------------------------------------------
| 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 _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
urllib.parse.ParseResult
Python Library Documentation: class ParseResult in module urllib.parse
class ParseResult(ParseResult, _NetlocResultMixinStr)
| ParseResult(scheme, netloc, path, params, query, fragment)
|
| Method resolution order:
| ParseResult
| ParseResult
| builtins.tuple
| _NetlocResultMixinStr
| _NetlocResultMixinBase
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.ParseResultBytes'>
|
| ----------------------------------------------------------------------
| Methods inherited from ParseResult:
|
| __getnewargs__(self) from collections.ParseResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.ParseResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.ParseResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.ParseResult
| Return a new ParseResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from ParseResult:
|
| _make(iterable) from collections.ParseResult
| Make a new ParseResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from ParseResult:
|
| __new__(_cls, scheme, netloc, path, params, query, fragment) from namedtuple_ParseResult.ParseResult
| Create new instance of ParseResult(scheme, netloc, path, params, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ParseResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| params
| Parameters for last path element used to dereference the URI in order to provide
| access to perform some operation on the resource.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ParseResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'params', 'query', 'frag...
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'params', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinStr:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
urllib.parse.ParseResultBytes
Python Library Documentation: class ParseResultBytes in module urllib.parse
class ParseResultBytes(ParseResult, _NetlocResultMixinBytes)
| ParseResultBytes(scheme, netloc, path, params, query, fragment)
|
| Method resolution order:
| ParseResultBytes
| ParseResult
| builtins.tuple
| _NetlocResultMixinBytes
| _NetlocResultMixinBase
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.ParseResult'>
|
| ----------------------------------------------------------------------
| Methods inherited from ParseResult:
|
| __getnewargs__(self) from collections.ParseResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.ParseResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.ParseResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.ParseResult
| Return a new ParseResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from ParseResult:
|
| _make(iterable) from collections.ParseResult
| Make a new ParseResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from ParseResult:
|
| __new__(_cls, scheme, netloc, path, params, query, fragment) from namedtuple_ParseResult.ParseResult
| Create new instance of ParseResult(scheme, netloc, path, params, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ParseResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| params
| Parameters for last path element used to dereference the URI in order to provide
| access to perform some operation on the resource.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from ParseResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'params', 'query', 'frag...
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'params', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBytes:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
urllib.parse.ResultBase
Python Library Documentation: class _NetlocResultMixinStr in module urllib.parse class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr) | Method resolution order: | _NetlocResultMixinStr | _NetlocResultMixinBase | _ResultMixinStr | builtins.object | | Class methods inherited from _NetlocResultMixinBase: | | __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 inherited from _NetlocResultMixinBase: | | hostname | | password | | port | | username | | ---------------------------------------------------------------------- | Methods inherited from _ResultMixinStr: | | encode(self, encoding='ascii', errors='strict')
urllib.parse.SplitResult
Python Library Documentation: class SplitResult in module urllib.parse
class SplitResult(SplitResult, _NetlocResultMixinStr)
| SplitResult(scheme, netloc, path, query, fragment)
|
| Method resolution order:
| SplitResult
| SplitResult
| builtins.tuple
| _NetlocResultMixinStr
| _NetlocResultMixinBase
| _ResultMixinStr
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _encoded_counterpart = <class 'urllib.parse.SplitResultBytes'>
|
| ----------------------------------------------------------------------
| Methods inherited from SplitResult:
|
| __getnewargs__(self) from collections.SplitResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.SplitResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.SplitResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.SplitResult
| Return a new SplitResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from SplitResult:
|
| _make(iterable) from collections.SplitResult
| Make a new SplitResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from SplitResult:
|
| __new__(_cls, scheme, netloc, path, query, fragment) from namedtuple_SplitResult.SplitResult
| Create new instance of SplitResult(scheme, netloc, path, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SplitResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from SplitResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinStr:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinStr:
|
| encode(self, encoding='ascii', errors='strict')
urllib.parse.SplitResultBytes
Python Library Documentation: class SplitResultBytes in module urllib.parse
class SplitResultBytes(SplitResult, _NetlocResultMixinBytes)
| SplitResultBytes(scheme, netloc, path, query, fragment)
|
| Method resolution order:
| SplitResultBytes
| SplitResult
| builtins.tuple
| _NetlocResultMixinBytes
| _NetlocResultMixinBase
| _ResultMixinBytes
| builtins.object
|
| Methods defined here:
|
| geturl(self)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| _decoded_counterpart = <class 'urllib.parse.SplitResult'>
|
| ----------------------------------------------------------------------
| Methods inherited from SplitResult:
|
| __getnewargs__(self) from collections.SplitResult
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.SplitResult
| Return a nicely formatted representation string
|
| _asdict(self) from collections.SplitResult
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.SplitResult
| Return a new SplitResult object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods inherited from SplitResult:
|
| _make(iterable) from collections.SplitResult
| Make a new SplitResult object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods inherited from SplitResult:
|
| __new__(_cls, scheme, netloc, path, query, fragment) from namedtuple_SplitResult.SplitResult
| Create new instance of SplitResult(scheme, netloc, path, query, fragment)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from SplitResult:
|
| scheme
| Specifies URL scheme for the request.
|
| netloc
| Network location where the request is made to.
|
| path
| The hierarchical path, such as the path to a file to download.
|
| query
| The query component, that contains non-hierarchical data, that along with data
| in path component, identifies a resource in the scope of URI's scheme and
| network location.
|
| fragment
| Fragment identifier, that allows indirect identification of a secondary resource
| by reference to a primary resource and additional identifying information.
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from SplitResult:
|
| __match_args__ = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| _field_defaults = {}
|
| _fields = ('scheme', 'netloc', 'path', 'query', 'fragment')
|
| ----------------------------------------------------------------------
| 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
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBytes:
|
| _hostinfo
|
| _userinfo
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _NetlocResultMixinBase:
|
| hostname
|
| password
|
| port
|
| username
|
| ----------------------------------------------------------------------
| Methods inherited from _ResultMixinBytes:
|
| decode(self, encoding='ascii', errors='strict')
urllib.parse.clear_cache
Python Library Documentation: function clear_cache in module urllib.parse
clear_cache()
Clear internal performance caches. Undocumented; some tests want it.
urllib.parse.functools
Python Library Documentation: module functools
NAME
functools - functools.py - Tools for working with functions and callable objects
MODULE REFERENCE
https://docs.python.org/3.12/library/functools.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
cached_property
partial
partialmethod
singledispatchmethod
class cached_property(builtins.object)
| cached_property(func)
|
| Methods defined here:
|
| __get__(self, instance, owner=None)
|
| __init__(self, func)
| Initialize self. See help(type(self)) for accurate signature.
|
| __set_name__(self, owner, name)
|
| ----------------------------------------------------------------------
| 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 descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class partial(builtins.object)
| partial(func, *args, **keywords) - new function with partial application
| of the given arguments and keywords.
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
|
| __vectorcalloffset__
|
| args
| tuple of arguments to future partial calls
|
| func
| function object to use in future partial calls
|
| keywords
| dictionary of keyword arguments to future partial calls
class partialmethod(builtins.object)
| partialmethod(func, /, *args, **keywords)
|
| Method descriptor with partial application of the given arguments
| and keywords.
|
| Supports wrapping existing descriptors and handles non-descriptor
| callables as instance methods.
|
| Methods defined here:
|
| __get__(self, obj, cls=None)
|
| __init__(self, func, /, *args, **keywords)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| ----------------------------------------------------------------------
| 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:
|
| __isabstractmethod__
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class singledispatchmethod(builtins.object)
| singledispatchmethod(func)
|
| Single-dispatch generic method descriptor.
|
| Supports wrapping existing descriptors and handles non-descriptor
| callables as instance methods.
|
| Methods defined here:
|
| __get__(self, obj, cls=None)
|
| __init__(self, func)
| Initialize self. See help(type(self)) for accurate signature.
|
| register(self, cls, method=None)
| generic_method.register(cls, func) -> func
|
| Registers a new implementation for the given *cls* on a *generic_method*.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| __isabstractmethod__
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
cache(user_function, /)
Simple lightweight unbounded cache. Sometimes called "memoize".
cmp_to_key(mycmp)
Convert a cmp= function into a key= function.
mycmp
Function that compares two objects.
lru_cache(maxsize=128, typed=False)
Least-recently-used cache decorator.
If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.
If *typed* is True, arguments of different types will be cached separately.
For example, f(3.0) and f(3) will be treated as distinct calls with
distinct results.
Arguments to the cached function must be hashable.
View the cache statistics named tuple (hits, misses, maxsize, currsize)
with f.cache_info(). Clear the cache and statistics with f.cache_clear().
Access the underlying function with f.__wrapped__.
See: https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
reduce(...)
reduce(function, iterable[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence
or iterable, from left to right, so as to reduce the iterable to a single
value. For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the iterable in the calculation, and serves as a default when the
iterable is empty.
singledispatch(func)
Single-dispatch generic function decorator.
Transforms a function into a generic function, which can have different
behaviours depending upon the type of its first argument. The decorated
function acts as the default implementation, and additional
implementations can be registered using the register() attribute of the
generic function.
total_ordering(cls)
Class decorator that fills in missing ordering methods
update_wrapper(wrapper, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))
Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))
Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
DATA
WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__qualname__', '__do...
WRAPPER_UPDATES = ('__dict__',)
__all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\functools.py
urllib.parse.ipaddress
Python Library Documentation: module ipaddress
NAME
ipaddress - A fast, lightweight IPv4/IPv6 manipulation library in Python.
MODULE REFERENCE
https://docs.python.org/3.12/library/ipaddress.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
This library is used to create/poke/manipulate IPv4 and IPv6 addresses
and networks.
CLASSES
builtins.ValueError(builtins.Exception)
AddressValueError
NetmaskValueError
_BaseAddress(_IPAddressBase)
IPv4Address(_BaseV4, _BaseAddress)
IPv4Interface
IPv6Address(_BaseV6, _BaseAddress)
IPv6Interface
_BaseNetwork(_IPAddressBase)
IPv4Network(_BaseV4, _BaseNetwork)
IPv6Network(_BaseV6, _BaseNetwork)
_BaseV4(builtins.object)
IPv4Address(_BaseV4, _BaseAddress)
IPv4Interface
IPv4Network(_BaseV4, _BaseNetwork)
_BaseV6(builtins.object)
IPv6Address(_BaseV6, _BaseAddress)
IPv6Interface
IPv6Network(_BaseV6, _BaseNetwork)
class AddressValueError(builtins.ValueError)
| A Value Error related to the address.
|
| Method resolution order:
| AddressValueError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.ValueError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.ValueError:
|
| __new__(*args, **kwargs) class method of builtins.ValueError
| 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 IPv4Address(_BaseV4, _BaseAddress)
| IPv4Address(address)
|
| Represent and manipulate single IPv4 Addresses.
|
| Method resolution order:
| IPv4Address
| _BaseV4
| _BaseAddress
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, address)
| Args:
| address: A string or integer representing the IP
|
| Additionally, an integer can be passed, so
| IPv4Address('192.0.2.1') == IPv4Address(3221225985).
| or, more generally
| IPv4Address(int(IPv4Address('192.0.2.1'))) ==
| IPv4Address('192.0.2.1')
|
| Raises:
| AddressValueError: If ipaddress isn't a valid IPv4 address.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| is_global
| ``True`` if the address is defined as globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exception:
|
| For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_global == address.ipv4_mapped.is_global
|
| ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is link-local per RFC 3927.
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback per RFC 3330.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is multicast.
| See RFC 3171 for details.
|
| is_private
| ``True`` if the address is defined as not globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exceptions:
|
| * ``is_private`` is ``False`` for ``100.64.0.0/10``
| * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_private == address.ipv4_mapped.is_private
|
| ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within the
| reserved IPv4 Network range.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 5735 3.
|
| packed
| The binary representation of this address.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV4:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseAddress:
|
| __add__(self, other)
| # Shorthand for Integer addition and subtraction. This is not
| # meant to ever support addition/subtraction of addresses.
|
| __eq__(self, other)
| Return self==value.
|
| __format__(self, fmt)
| Returns an IP address as a formatted string.
|
| Supported presentation types are:
| 's': returns the IP address as a string (default)
| 'b': converts to binary and returns a zero-padded string
| 'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded string
| 'n': the same as 'b' for IPv4 and 'x' for IPv6
|
| For binary and hex presentation types, the alternate form specifier
| '#' and the grouping option '_' are supported.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __hash__(self)
| Return hash(self).
|
| __int__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __lt__(self, other)
| Return self<value.
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self)
| Return str(self).
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class IPv4Interface(IPv4Address)
| IPv4Interface(address)
|
| Method resolution order:
| IPv4Interface
| IPv4Address
| _BaseV4
| _BaseAddress
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, address)
| Args:
| address: A string or integer representing the IP
|
| Additionally, an integer can be passed, so
| IPv4Address('192.0.2.1') == IPv4Address(3221225985).
| or, more generally
| IPv4Address(int(IPv4Address('192.0.2.1'))) ==
| IPv4Address('192.0.2.1')
|
| Raises:
| AddressValueError: If ipaddress isn't a valid IPv4 address.
|
| __lt__(self, other)
| Return self<value.
|
| __reduce__(self) from _IPAddressBase
| Helper for pickle.
|
| __str__(self)
| Return str(self).
|
| hostmask = <functools.cached_property object>
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ip
|
| with_hostmask
|
| with_netmask
|
| with_prefixlen
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| ----------------------------------------------------------------------
| Readonly properties inherited from IPv4Address:
|
| is_global
| ``True`` if the address is defined as globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exception:
|
| For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_global == address.ipv4_mapped.is_global
|
| ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is link-local per RFC 3927.
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback per RFC 3330.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is multicast.
| See RFC 3171 for details.
|
| is_private
| ``True`` if the address is defined as not globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exceptions:
|
| * ``is_private`` is ``False`` for ``100.64.0.0/10``
| * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_private == address.ipv4_mapped.is_private
|
| ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within the
| reserved IPv4 Network range.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 5735 3.
|
| packed
| The binary representation of this address.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from IPv4Address:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV4:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseAddress:
|
| __add__(self, other)
| # Shorthand for Integer addition and subtraction. This is not
| # meant to ever support addition/subtraction of addresses.
|
| __format__(self, fmt)
| Returns an IP address as a formatted string.
|
| Supported presentation types are:
| 's': returns the IP address as a string (default)
| 'b': converts to binary and returns a zero-padded string
| 'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded string
| 'n': the same as 'b' for IPv4 and 'x' for IPv6
|
| For binary and hex presentation types, the alternate form specifier
| '#' and the grouping option '_' are supported.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __int__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __repr__(self)
| Return repr(self).
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class IPv4Network(_BaseV4, _BaseNetwork)
| IPv4Network(address, strict=True)
|
| This class represents and manipulates 32-bit IPv4 network + addresses..
|
| Attributes: [examples for IPv4Network('192.0.2.0/27')]
| .network_address: IPv4Address('192.0.2.0')
| .hostmask: IPv4Address('0.0.0.31')
| .broadcast_address: IPv4Address('192.0.2.32')
| .netmask: IPv4Address('255.255.255.224')
| .prefixlen: 27
|
| Method resolution order:
| IPv4Network
| _BaseV4
| _BaseNetwork
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, address, strict=True)
| Instantiate a new IPv4 network object.
|
| Args:
| address: A string or integer representing the IP [& network].
| '192.0.2.0/24'
| '192.0.2.0/255.255.255.0'
| '192.0.2.0/0.0.0.255'
| are all functionally the same in IPv4. Similarly,
| '192.0.2.1'
| '192.0.2.1/255.255.255.255'
| '192.0.2.1/32'
| are also functionally equivalent. That is to say, failing to
| provide a subnetmask will create an object with a mask of /32.
|
| If the mask (portion after the / in the argument) is given in
| dotted quad form, it is treated as a netmask if it starts with a
| non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it
| starts with a zero field (e.g. 0.255.255.255 == /8), with the
| single exception of an all-zero mask which is treated as a
| netmask == /0. If no mask is given, a default of /32 is used.
|
| Additionally, an integer can be passed, so
| IPv4Network('192.0.2.1') == IPv4Network(3221225985)
| or, more generally
| IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
| IPv4Interface('192.0.2.1')
|
| Raises:
| AddressValueError: If ipaddress isn't a valid IPv4 address.
| NetmaskValueError: If the netmask isn't valid for
| an IPv4 address.
| ValueError: If strict is True and a network address is not
| supplied.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| is_global
| Test if this address is allocated for public networks.
|
| Returns:
| A boolean, True if the address is not reserved per
| iana-ipv4-special-registry.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV4:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseNetwork:
|
| __contains__(self, other)
|
| __eq__(self, other)
| Return self==value.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __getitem__(self, n)
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __hash__(self)
| Return hash(self).
|
| __iter__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __lt__(self, other)
| Return self<value.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self)
| Return str(self).
|
| address_exclude(self, other)
| Remove an address from a larger block.
|
| For example:
|
| addr1 = ip_network('192.0.2.0/28')
| addr2 = ip_network('192.0.2.1/32')
| list(addr1.address_exclude(addr2)) =
| [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
| IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]
|
| or IPv6:
|
| addr1 = ip_network('2001:db8::1/32')
| addr2 = ip_network('2001:db8::1/128')
| list(addr1.address_exclude(addr2)) =
| [ip_network('2001:db8::1/128'),
| ip_network('2001:db8::2/127'),
| ip_network('2001:db8::4/126'),
| ip_network('2001:db8::8/125'),
| ...
| ip_network('2001:db8:8000::/33')]
|
| Args:
| other: An IPv4Network or IPv6Network object of the same type.
|
| Returns:
| An iterator of the IPv(4|6)Network objects which is self
| minus other.
|
| Raises:
| TypeError: If self and other are of differing address
| versions, or if other is not a network object.
| ValueError: If other is not completely contained by self.
|
| broadcast_address = <functools.cached_property object>
| compare_networks(self, other)
| Compare two IP objects.
|
| This is only concerned about the comparison of the integer
| representation of the network addresses. This means that the
| host bits aren't considered at all in this method. If you want
| to compare host bits, you can easily enough do a
| 'HostA._ip < HostB._ip'
|
| Args:
| other: An IP object.
|
| Returns:
| If the IP versions of self and other are the same, returns:
|
| -1 if self < other:
| eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
| IPv6Network('2001:db8::1000/124') <
| IPv6Network('2001:db8::2000/124')
| 0 if self == other
| eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
| IPv6Network('2001:db8::1000/124') ==
| IPv6Network('2001:db8::1000/124')
| 1 if self > other
| eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
| IPv6Network('2001:db8::2000/124') >
| IPv6Network('2001:db8::1000/124')
|
| Raises:
| TypeError if the IP versions are different.
|
| hostmask = <functools.cached_property object>
| hosts(self)
| Generate Iterator over usable hosts in a network.
|
| This is like __iter__ except it doesn't return the network
| or broadcast addresses.
|
| overlaps(self, other)
| Tell if self is partly contained in other.
|
| subnet_of(self, other)
| Return True if this network is a subnet of other.
|
| subnets(self, prefixlen_diff=1, new_prefix=None)
| The subnets which join to make the current subnet.
|
| In the case that self contains only one IP
| (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
| for IPv6), yield an iterator with just ourself.
|
| Args:
| prefixlen_diff: An integer, the amount the prefix length
| should be increased by. This should not be set if
| new_prefix is also set.
| new_prefix: The desired new prefix length. This must be a
| larger number (smaller prefix) than the existing prefix.
| This should not be set if prefixlen_diff is also set.
|
| Returns:
| An iterator of IPv(4|6) objects.
|
| Raises:
| ValueError: The prefixlen_diff is too small or too large.
| OR
| prefixlen_diff and new_prefix are both set or new_prefix
| is a smaller number than the current prefix (smaller
| number means a larger network)
|
| supernet(self, prefixlen_diff=1, new_prefix=None)
| The supernet containing the current network.
|
| Args:
| prefixlen_diff: An integer, the amount the prefix length of
| the network should be decreased by. For example, given a
| /24 network and a prefixlen_diff of 3, a supernet with a
| /21 netmask is returned.
|
| Returns:
| An IPv4 network object.
|
| Raises:
| ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
| a negative prefix length.
| OR
| If prefixlen_diff and new_prefix are both set or new_prefix is a
| larger number than the current prefix (larger number means a
| smaller network)
|
| supernet_of(self, other)
| Return True if this network is a supernet of other.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseNetwork:
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is reserved per RFC 4291.
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback address as defined in
| RFC 2373 2.5.3.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is a multicast address.
| See RFC 2373 2.7 for details.
|
| is_private
| Test if this network belongs to a private range.
|
| Returns:
| A boolean, True if the network is reserved per
| iana-ipv4-special-registry or iana-ipv6-special-registry.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within one of the
| reserved IPv6 Network ranges.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 2373 2.5.2.
|
| num_addresses
| Number of hosts in the current subnet.
|
| prefixlen
|
| with_hostmask
|
| with_netmask
|
| with_prefixlen
|
| ----------------------------------------------------------------------
| Methods inherited from _IPAddressBase:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class IPv6Address(_BaseV6, _BaseAddress)
| IPv6Address(address)
|
| Represent and manipulate single IPv6 Addresses.
|
| Method resolution order:
| IPv6Address
| _BaseV6
| _BaseAddress
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, address)
| Instantiate a new IPv6 address object.
|
| Args:
| address: A string or integer representing the IP
|
| Additionally, an integer can be passed, so
| IPv6Address('2001:db8::') ==
| IPv6Address(42540766411282592856903984951653826560)
| or, more generally
| IPv6Address(int(IPv6Address('2001:db8::'))) ==
| IPv6Address('2001:db8::')
|
| Raises:
| AddressValueError: If address isn't a valid IPv6 address.
|
| __reduce__(self)
| Helper for pickle.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ipv4_mapped
| Return the IPv4 mapped address.
|
| Returns:
| If the IPv6 address is a v4 mapped address, return the
| IPv4 mapped address. Return None otherwise.
|
| is_global
| ``True`` if the address is defined as globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exception:
|
| For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_global == address.ipv4_mapped.is_global
|
| ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is reserved per RFC 4291.
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback address as defined in
| RFC 2373 2.5.3.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is a multicast address.
| See RFC 2373 2.7 for details.
|
| is_private
| ``True`` if the address is defined as not globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exceptions:
|
| * ``is_private`` is ``False`` for ``100.64.0.0/10``
| * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_private == address.ipv4_mapped.is_private
|
| ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within one of the
| reserved IPv6 Network ranges.
|
| is_site_local
| Test if the address is reserved for site-local.
|
| Note that the site-local address space has been deprecated by RFC 3879.
| Use is_private to test if this address is in the space of unique local
| addresses as defined by RFC 4193.
|
| Returns:
| A boolean, True if the address is reserved per RFC 3513 2.5.6.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 2373 2.5.2.
|
| packed
| The binary representation of this address.
|
| scope_id
| Identifier of a particular zone of the address's scope.
|
| See RFC 4007 for details.
|
| Returns:
| A string identifying the zone of the address if specified, else None.
|
| sixtofour
| Return the IPv4 6to4 embedded address.
|
| Returns:
| The IPv4 6to4-embedded address if present or None if the
| address doesn't appear to contain a 6to4 embedded address.
|
| teredo
| Tuple of embedded teredo IPs.
|
| Returns:
| Tuple of the (server, client) IPs or None if the address
| doesn't appear to be a teredo address (doesn't start with
| 2001::/32)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV6:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseAddress:
|
| __add__(self, other)
| # Shorthand for Integer addition and subtraction. This is not
| # meant to ever support addition/subtraction of addresses.
|
| __format__(self, fmt)
| Returns an IP address as a formatted string.
|
| Supported presentation types are:
| 's': returns the IP address as a string (default)
| 'b': converts to binary and returns a zero-padded string
| 'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded string
| 'n': the same as 'b' for IPv4 and 'x' for IPv6
|
| For binary and hex presentation types, the alternate form specifier
| '#' and the grouping option '_' are supported.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __int__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __lt__(self, other)
| Return self<value.
|
| __repr__(self)
| Return repr(self).
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class IPv6Interface(IPv6Address)
| IPv6Interface(address)
|
| Method resolution order:
| IPv6Interface
| IPv6Address
| _BaseV6
| _BaseAddress
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, address)
| Instantiate a new IPv6 address object.
|
| Args:
| address: A string or integer representing the IP
|
| Additionally, an integer can be passed, so
| IPv6Address('2001:db8::') ==
| IPv6Address(42540766411282592856903984951653826560)
| or, more generally
| IPv6Address(int(IPv6Address('2001:db8::'))) ==
| IPv6Address('2001:db8::')
|
| Raises:
| AddressValueError: If address isn't a valid IPv6 address.
|
| __lt__(self, other)
| Return self<value.
|
| __reduce__(self) from _IPAddressBase
| Helper for pickle.
|
| __str__(self)
| Return str(self).
|
| hostmask = <functools.cached_property object>
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| ip
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback address as defined in
| RFC 2373 2.5.3.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 2373 2.5.2.
|
| with_hostmask
|
| with_netmask
|
| with_prefixlen
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| ----------------------------------------------------------------------
| Readonly properties inherited from IPv6Address:
|
| ipv4_mapped
| Return the IPv4 mapped address.
|
| Returns:
| If the IPv6 address is a v4 mapped address, return the
| IPv4 mapped address. Return None otherwise.
|
| is_global
| ``True`` if the address is defined as globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exception:
|
| For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_global == address.ipv4_mapped.is_global
|
| ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is reserved per RFC 4291.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is a multicast address.
| See RFC 2373 2.7 for details.
|
| is_private
| ``True`` if the address is defined as not globally reachable by
| iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
| (for IPv6) with the following exceptions:
|
| * ``is_private`` is ``False`` for ``100.64.0.0/10``
| * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
| semantics of the underlying IPv4 addresses and the following condition holds
| (see :attr:`IPv6Address.ipv4_mapped`)::
|
| address.is_private == address.ipv4_mapped.is_private
|
| ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
| IPv4 range where they are both ``False``.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within one of the
| reserved IPv6 Network ranges.
|
| is_site_local
| Test if the address is reserved for site-local.
|
| Note that the site-local address space has been deprecated by RFC 3879.
| Use is_private to test if this address is in the space of unique local
| addresses as defined by RFC 4193.
|
| Returns:
| A boolean, True if the address is reserved per RFC 3513 2.5.6.
|
| packed
| The binary representation of this address.
|
| scope_id
| Identifier of a particular zone of the address's scope.
|
| See RFC 4007 for details.
|
| Returns:
| A string identifying the zone of the address if specified, else None.
|
| sixtofour
| Return the IPv4 6to4 embedded address.
|
| Returns:
| The IPv4 6to4-embedded address if present or None if the
| address doesn't appear to contain a 6to4 embedded address.
|
| teredo
| Tuple of embedded teredo IPs.
|
| Returns:
| Tuple of the (server, client) IPs or None if the address
| doesn't appear to be a teredo address (doesn't start with
| 2001::/32)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from IPv6Address:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV6:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseAddress:
|
| __add__(self, other)
| # Shorthand for Integer addition and subtraction. This is not
| # meant to ever support addition/subtraction of addresses.
|
| __format__(self, fmt)
| Returns an IP address as a formatted string.
|
| Supported presentation types are:
| 's': returns the IP address as a string (default)
| 'b': converts to binary and returns a zero-padded string
| 'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded string
| 'n': the same as 'b' for IPv4 and 'x' for IPv6
|
| For binary and hex presentation types, the alternate form specifier
| '#' and the grouping option '_' are supported.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __int__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __repr__(self)
| Return repr(self).
|
| __sub__(self, other)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class IPv6Network(_BaseV6, _BaseNetwork)
| IPv6Network(address, strict=True)
|
| This class represents and manipulates 128-bit IPv6 networks.
|
| Attributes: [examples for IPv6('2001:db8::1000/124')]
| .network_address: IPv6Address('2001:db8::1000')
| .hostmask: IPv6Address('::f')
| .broadcast_address: IPv6Address('2001:db8::100f')
| .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
| .prefixlen: 124
|
| Method resolution order:
| IPv6Network
| _BaseV6
| _BaseNetwork
| _IPAddressBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, address, strict=True)
| Instantiate a new IPv6 Network object.
|
| Args:
| address: A string or integer representing the IPv6 network or the
| IP and prefix/netmask.
| '2001:db8::/128'
| '2001:db8:0000:0000:0000:0000:0000:0000/128'
| '2001:db8::'
| are all functionally the same in IPv6. That is to say,
| failing to provide a subnetmask will create an object with
| a mask of /128.
|
| Additionally, an integer can be passed, so
| IPv6Network('2001:db8::') ==
| IPv6Network(42540766411282592856903984951653826560)
| or, more generally
| IPv6Network(int(IPv6Network('2001:db8::'))) ==
| IPv6Network('2001:db8::')
|
| strict: A boolean. If true, ensure that we have been passed
| A true network address, eg, 2001:db8::1000/124 and not an
| IP address on a network, eg, 2001:db8::1/124.
|
| Raises:
| AddressValueError: If address isn't a valid IPv6 address.
| NetmaskValueError: If the netmask isn't valid for
| an IPv6 address.
| ValueError: If strict was True and a network address was not
| supplied.
|
| hosts(self)
| Generate Iterator over usable hosts in a network.
|
| This is like __iter__ except it doesn't return the
| Subnet-Router anycast address.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| is_site_local
| Test if the address is reserved for site-local.
|
| Note that the site-local address space has been deprecated by RFC 3879.
| Use is_private to test if this address is in the space of unique local
| addresses as defined by RFC 4193.
|
| Returns:
| A boolean, True if the address is reserved per RFC 3513 2.5.6.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseV6:
|
| max_prefixlen
|
| version
|
| ----------------------------------------------------------------------
| Methods inherited from _BaseNetwork:
|
| __contains__(self, other)
|
| __eq__(self, other)
| Return self==value.
|
| __ge__(self, other) from functools
| Return a >= b. Computed by @total_ordering from (not a < b).
|
| __getitem__(self, n)
|
| __gt__(self, other) from functools
| Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
|
| __hash__(self)
| Return hash(self).
|
| __iter__(self)
|
| __le__(self, other) from functools
| Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
|
| __lt__(self, other)
| Return self<value.
|
| __repr__(self)
| Return repr(self).
|
| __str__(self)
| Return str(self).
|
| address_exclude(self, other)
| Remove an address from a larger block.
|
| For example:
|
| addr1 = ip_network('192.0.2.0/28')
| addr2 = ip_network('192.0.2.1/32')
| list(addr1.address_exclude(addr2)) =
| [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
| IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]
|
| or IPv6:
|
| addr1 = ip_network('2001:db8::1/32')
| addr2 = ip_network('2001:db8::1/128')
| list(addr1.address_exclude(addr2)) =
| [ip_network('2001:db8::1/128'),
| ip_network('2001:db8::2/127'),
| ip_network('2001:db8::4/126'),
| ip_network('2001:db8::8/125'),
| ...
| ip_network('2001:db8:8000::/33')]
|
| Args:
| other: An IPv4Network or IPv6Network object of the same type.
|
| Returns:
| An iterator of the IPv(4|6)Network objects which is self
| minus other.
|
| Raises:
| TypeError: If self and other are of differing address
| versions, or if other is not a network object.
| ValueError: If other is not completely contained by self.
|
| broadcast_address = <functools.cached_property object>
| compare_networks(self, other)
| Compare two IP objects.
|
| This is only concerned about the comparison of the integer
| representation of the network addresses. This means that the
| host bits aren't considered at all in this method. If you want
| to compare host bits, you can easily enough do a
| 'HostA._ip < HostB._ip'
|
| Args:
| other: An IP object.
|
| Returns:
| If the IP versions of self and other are the same, returns:
|
| -1 if self < other:
| eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
| IPv6Network('2001:db8::1000/124') <
| IPv6Network('2001:db8::2000/124')
| 0 if self == other
| eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
| IPv6Network('2001:db8::1000/124') ==
| IPv6Network('2001:db8::1000/124')
| 1 if self > other
| eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
| IPv6Network('2001:db8::2000/124') >
| IPv6Network('2001:db8::1000/124')
|
| Raises:
| TypeError if the IP versions are different.
|
| hostmask = <functools.cached_property object>
| overlaps(self, other)
| Tell if self is partly contained in other.
|
| subnet_of(self, other)
| Return True if this network is a subnet of other.
|
| subnets(self, prefixlen_diff=1, new_prefix=None)
| The subnets which join to make the current subnet.
|
| In the case that self contains only one IP
| (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
| for IPv6), yield an iterator with just ourself.
|
| Args:
| prefixlen_diff: An integer, the amount the prefix length
| should be increased by. This should not be set if
| new_prefix is also set.
| new_prefix: The desired new prefix length. This must be a
| larger number (smaller prefix) than the existing prefix.
| This should not be set if prefixlen_diff is also set.
|
| Returns:
| An iterator of IPv(4|6) objects.
|
| Raises:
| ValueError: The prefixlen_diff is too small or too large.
| OR
| prefixlen_diff and new_prefix are both set or new_prefix
| is a smaller number than the current prefix (smaller
| number means a larger network)
|
| supernet(self, prefixlen_diff=1, new_prefix=None)
| The supernet containing the current network.
|
| Args:
| prefixlen_diff: An integer, the amount the prefix length of
| the network should be decreased by. For example, given a
| /24 network and a prefixlen_diff of 3, a supernet with a
| /21 netmask is returned.
|
| Returns:
| An IPv4 network object.
|
| Raises:
| ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
| a negative prefix length.
| OR
| If prefixlen_diff and new_prefix are both set or new_prefix is a
| larger number than the current prefix (larger number means a
| smaller network)
|
| supernet_of(self, other)
| Return True if this network is a supernet of other.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _BaseNetwork:
|
| is_global
| Test if this address is allocated for public networks.
|
| Returns:
| A boolean, True if the address is not reserved per
| iana-ipv4-special-registry or iana-ipv6-special-registry.
|
| is_link_local
| Test if the address is reserved for link-local.
|
| Returns:
| A boolean, True if the address is reserved per RFC 4291.
|
| is_loopback
| Test if the address is a loopback address.
|
| Returns:
| A boolean, True if the address is a loopback address as defined in
| RFC 2373 2.5.3.
|
| is_multicast
| Test if the address is reserved for multicast use.
|
| Returns:
| A boolean, True if the address is a multicast address.
| See RFC 2373 2.7 for details.
|
| is_private
| Test if this network belongs to a private range.
|
| Returns:
| A boolean, True if the network is reserved per
| iana-ipv4-special-registry or iana-ipv6-special-registry.
|
| is_reserved
| Test if the address is otherwise IETF reserved.
|
| Returns:
| A boolean, True if the address is within one of the
| reserved IPv6 Network ranges.
|
| is_unspecified
| Test if the address is unspecified.
|
| Returns:
| A boolean, True if this is the unspecified address as defined in
| RFC 2373 2.5.2.
|
| num_addresses
| Number of hosts in the current subnet.
|
| prefixlen
|
| with_hostmask
|
| with_netmask
|
| with_prefixlen
|
| ----------------------------------------------------------------------
| Methods inherited from _IPAddressBase:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Readonly properties inherited from _IPAddressBase:
|
| compressed
| Return the shorthand version of the IP address as a string.
|
| exploded
| Return the longhand version of the IP address as a string.
|
| reverse_pointer
| The name of the reverse DNS pointer for the IP address, e.g.:
| >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
| '1.0.0.127.in-addr.arpa'
| >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
| '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
class NetmaskValueError(builtins.ValueError)
| A Value Error related to the netmask.
|
| Method resolution order:
| NetmaskValueError
| builtins.ValueError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.ValueError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.ValueError:
|
| __new__(*args, **kwargs) class method of builtins.ValueError
| 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
FUNCTIONS
collapse_addresses(addresses)
Collapse a list of IP objects.
Example:
collapse_addresses([IPv4Network('192.0.2.0/25'),
IPv4Network('192.0.2.128/25')]) ->
[IPv4Network('192.0.2.0/24')]
Args:
addresses: An iterable of IPv4Network or IPv6Network objects.
Returns:
An iterator of the collapsed IPv(4|6)Network objects.
Raises:
TypeError: If passed a list of mixed version objects.
get_mixed_type_key(obj)
Return a key suitable for sorting between networks and addresses.
Address and Network objects are not sortable by default; they're
fundamentally different so the expression
IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')
doesn't make any sense. There are some times however, where you may wish
to have ipaddress sort these for you anyway. If you need to do this, you
can use this function as the key= argument to sorted().
Args:
obj: either a Network or Address object.
Returns:
appropriate key.
ip_address(address)
Take an IP string/int and return an object of the correct type.
Args:
address: A string or integer, the IP address. Either IPv4 or
IPv6 addresses may be supplied; integers less than 2**32 will
be considered to be IPv4 by default.
Returns:
An IPv4Address or IPv6Address object.
Raises:
ValueError: if the *address* passed isn't either a v4 or a v6
address
ip_interface(address)
Take an IP string/int and return an object of the correct type.
Args:
address: A string or integer, the IP address. Either IPv4 or
IPv6 addresses may be supplied; integers less than 2**32 will
be considered to be IPv4 by default.
Returns:
An IPv4Interface or IPv6Interface object.
Raises:
ValueError: if the string passed isn't either a v4 or a v6
address.
Notes:
The IPv?Interface classes describe an Address on a particular
Network, so they're basically a combination of both the Address
and Network classes.
ip_network(address, strict=True)
Take an IP string/int and return an object of the correct type.
Args:
address: A string or integer, the IP network. Either IPv4 or
IPv6 networks may be supplied; integers less than 2**32 will
be considered to be IPv4 by default.
Returns:
An IPv4Network or IPv6Network object.
Raises:
ValueError: if the string passed isn't either a v4 or a v6
address. Or if the network has host bits set.
summarize_address_range(first, last)
Summarize a network range given the first and last IP addresses.
Example:
>>> list(summarize_address_range(IPv4Address('192.0.2.0'),
... IPv4Address('192.0.2.130')))
... #doctest: +NORMALIZE_WHITESPACE
[IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'),
IPv4Network('192.0.2.130/32')]
Args:
first: the first IPv4Address or IPv6Address in the range.
last: the last IPv4Address or IPv6Address in the range.
Returns:
An iterator of the summarized IPv(4|6) network objects.
Raise:
TypeError:
If the first and last objects are not IP addresses.
If the first and last objects are not the same version.
ValueError:
If the last object is not greater than the first.
If the version of the first address is not 4 or 6.
v4_int_to_packed(address)
Represent an address as 4 packed bytes in network (big-endian) order.
Args:
address: An integer representation of an IPv4 IP address.
Returns:
The integer address packed as 4 bytes in network (big-endian) order.
Raises:
ValueError: If the integer is negative or too large to be an
IPv4 IP address.
v6_int_to_packed(address)
Represent an address as 16 packed bytes in network (big-endian) order.
Args:
address: An integer representation of an IPv6 IP address.
Returns:
The integer address packed as 16 bytes in network (big-endian) order.
DATA
IPV4LENGTH = 32
IPV6LENGTH = 128
VERSION
1.0
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\ipaddress.py
urllib.parse.math
Python Library Documentation: built-in module math
NAME
math
DESCRIPTION
This module provides access to the mathematical functions
defined by the C standard.
FUNCTIONS
acos(x, /)
Return the arc cosine (measured in radians) of x.
The result is between 0 and pi.
acosh(x, /)
Return the inverse hyperbolic cosine of x.
asin(x, /)
Return the arc sine (measured in radians) of x.
The result is between -pi/2 and pi/2.
asinh(x, /)
Return the inverse hyperbolic sine of x.
atan(x, /)
Return the arc tangent (measured in radians) of x.
The result is between -pi/2 and pi/2.
atan2(y, x, /)
Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.
atanh(x, /)
Return the inverse hyperbolic tangent of x.
cbrt(x, /)
Return the cube root of x.
ceil(x, /)
Return the ceiling of x as an Integral.
This is the smallest integer >= x.
comb(n, k, /)
Number of ways to choose k items from n items without repetition and without order.
Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates
to zero when k > n.
Also called the binomial coefficient because it is equivalent
to the coefficient of k-th term in polynomial expansion of the
expression (1 + x)**n.
Raises TypeError if either of the arguments are not integers.
Raises ValueError if either of the arguments are negative.
copysign(x, y, /)
Return a float with the magnitude (absolute value) of x but the sign of y.
On platforms that support signed zeros, copysign(1.0, -0.0)
returns -1.0.
cos(x, /)
Return the cosine of x (measured in radians).
cosh(x, /)
Return the hyperbolic cosine of x.
degrees(x, /)
Convert angle x from radians to degrees.
dist(p, q, /)
Return the Euclidean distance between two points p and q.
The points should be specified as sequences (or iterables) of
coordinates. Both inputs must have the same dimension.
Roughly equivalent to:
sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))
erf(x, /)
Error function at x.
erfc(x, /)
Complementary error function at x.
exp(x, /)
Return e raised to the power of x.
exp2(x, /)
Return 2 raised to the power of x.
expm1(x, /)
Return exp(x)-1.
This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.
fabs(x, /)
Return the absolute value of the float x.
factorial(n, /)
Find n!.
Raise a ValueError if x is negative or non-integral.
floor(x, /)
Return the floor of x as an Integral.
This is the largest integer <= x.
fmod(x, y, /)
Return fmod(x, y), according to platform C.
x % y may differ.
frexp(x, /)
Return the mantissa and exponent of x, as pair (m, e).
m is a float and e is an int, such that x = m * 2.**e.
If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.
fsum(seq, /)
Return an accurate floating-point sum of values in the iterable seq.
Assumes IEEE-754 floating-point arithmetic.
gamma(x, /)
Gamma function at x.
gcd(*integers)
Greatest Common Divisor.
hypot(...)
hypot(*coordinates) -> value
Multidimensional Euclidean distance from the origin to a point.
Roughly equivalent to:
sqrt(sum(x**2 for x in coordinates))
For a two dimensional point (x, y), gives the hypotenuse
using the Pythagorean theorem: sqrt(x*x + y*y).
For example, the hypotenuse of a 3/4/5 right triangle is:
>>> hypot(3.0, 4.0)
5.0
isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
Determine whether two floating-point numbers are close in value.
rel_tol
maximum difference for being considered "close", relative to the
magnitude of the input values
abs_tol
maximum difference for being considered "close", regardless of the
magnitude of the input values
Return True if a is close in value to b, and False otherwise.
For the values to be considered close, the difference between them
must be smaller than at least one of the tolerances.
-inf, inf and NaN behave similarly to the IEEE 754 Standard. That
is, NaN is not close to anything, even itself. inf and -inf are
only close to themselves.
isfinite(x, /)
Return True if x is neither an infinity nor a NaN, and False otherwise.
isinf(x, /)
Return True if x is a positive or negative infinity, and False otherwise.
isnan(x, /)
Return True if x is a NaN (not a number), and False otherwise.
isqrt(n, /)
Return the integer part of the square root of the input.
lcm(*integers)
Least Common Multiple.
ldexp(x, i, /)
Return x * (2**i).
This is essentially the inverse of frexp().
lgamma(x, /)
Natural logarithm of absolute value of Gamma function at x.
log(...)
log(x, [base=math.e])
Return the logarithm of x to the given base.
If the base is not specified, returns the natural logarithm (base e) of x.
log10(x, /)
Return the base 10 logarithm of x.
log1p(x, /)
Return the natural logarithm of 1+x (base e).
The result is computed in a way which is accurate for x near zero.
log2(x, /)
Return the base 2 logarithm of x.
modf(x, /)
Return the fractional and integer parts of x.
Both results carry the sign of x and are floats.
nextafter(x, y, /, *, steps=None)
Return the floating-point value the given number of steps after x towards y.
If steps is not specified or is None, it defaults to 1.
Raises a TypeError, if x or y is not a double, or if steps is not an integer.
Raises ValueError if steps is negative.
perm(n, k=None, /)
Number of ways to choose k items from n items without repetition and with order.
Evaluates to n! / (n - k)! when k <= n and evaluates
to zero when k > n.
If k is not specified or is None, then k defaults to n
and the function returns n!.
Raises TypeError if either of the arguments are not integers.
Raises ValueError if either of the arguments are negative.
pow(x, y, /)
Return x**y (x to the power of y).
prod(iterable, /, *, start=1)
Calculate the product of all the elements in the input iterable.
The default start value for the product is 1.
When the iterable is empty, return the start value. This function is
intended specifically for use with numeric values and may reject
non-numeric types.
radians(x, /)
Convert angle x from degrees to radians.
remainder(x, y, /)
Difference between x and the closest integer multiple of y.
Return x - n*y where n*y is the closest integer multiple of y.
In the case where x is exactly halfway between two multiples of
y, the nearest even value of n is used. The result is always exact.
sin(x, /)
Return the sine of x (measured in radians).
sinh(x, /)
Return the hyperbolic sine of x.
sqrt(x, /)
Return the square root of x.
sumprod(p, q, /)
Return the sum of products of values from two iterables p and q.
Roughly equivalent to:
sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))
For float and mixed int/float inputs, the intermediate products
and sums are computed with extended precision.
tan(x, /)
Return the tangent of x (measured in radians).
tanh(x, /)
Return the hyperbolic tangent of x.
trunc(x, /)
Truncates the Real x to the nearest Integral toward 0.
Uses the __trunc__ magic method.
ulp(x, /)
Return the value of the least significant bit of the float x.
DATA
e = 2.718281828459045
inf = inf
nan = nan
pi = 3.141592653589793
tau = 6.283185307179586
FILE
(built-in)
urllib.parse.namedtuple
Python Library Documentation: function namedtuple in module collections
namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)
Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args or keywords
>>> p[0] + p[1] # indexable like a plain tuple
33
>>> x, y = p # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y # fields also accessible by name
33
>>> d = p._asdict() # convert to a dictionary
>>> d['x']
11
>>> Point(**d) # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
urllib.parse.non_hierarchical
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.parse_qs
Python Library Documentation: function parse_qs in module urllib.parse
parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Parse a query given as a string argument.
Arguments:
qs: percent-encoded query string to be parsed
keep_blank_values: flag indicating whether blank values in
percent-encoded queries should be treated as blank strings.
A true value indicates that blanks should be retained as
blank strings. The default false value indicates that
blank values are to be ignored and treated as if they were
not included.
strict_parsing: flag indicating what to do with parsing errors.
If false (the default), errors are silently ignored.
If true, errors raise a ValueError exception.
encoding and errors: specify how to decode percent-encoded sequences
into Unicode characters, as accepted by the bytes.decode() method.
max_num_fields: int. If set, then throws a ValueError if there
are more than n fields read by parse_qsl().
separator: str. The symbol to use for separating the query arguments.
Defaults to &.
Returns a dictionary.
urllib.parse.parse_qsl
Python Library Documentation: function parse_qsl in module urllib.parse
parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Parse a query given as a string argument.
Arguments:
qs: percent-encoded query string to be parsed
keep_blank_values: flag indicating whether blank values in
percent-encoded queries should be treated as blank strings.
A true value indicates that blanks should be retained as blank
strings. The default false value indicates that blank values
are to be ignored and treated as if they were not included.
strict_parsing: flag indicating what to do with parsing errors. If
false (the default), errors are silently ignored. If true,
errors raise a ValueError exception.
encoding and errors: specify how to decode percent-encoded sequences
into Unicode characters, as accepted by the bytes.decode() method.
max_num_fields: int. If set, then throws a ValueError
if there are more than n fields read by parse_qsl().
separator: str. The symbol to use for separating the query arguments.
Defaults to &.
Returns a list, as G-d intended.
urllib.parse.quote
Python Library Documentation: function quote in module urllib.parse
quote(string, safe='/', encoding=None, errors=None)
quote('abc def') -> 'abc%20def'
Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted. The
quote function offers a cautious (not minimal) way to quote a
string for most of these parts.
RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists
the following (un)reserved characters.
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Each of the reserved characters is reserved in some component of a URL,
but not necessarily in all of them.
The quote function %-escapes all characters that are neither in the
unreserved chars ("always safe") nor the additional chars set via the
safe arg.
The default for the safe arg is '/'. The character is reserved, but in
typical usage the quote function is being called on a path where the
existing slash characters are to be preserved.
Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings.
Now, "~" is included in the set of unreserved characters.
string and safe may be either str or bytes objects. encoding and errors
must not be specified if string is a bytes object.
The optional encoding and errors parameters specify how to deal with
non-ASCII characters, as accepted by the str.encode method.
By default, encoding='utf-8' (characters are encoded with UTF-8), and
errors='strict' (unsupported characters raise a UnicodeEncodeError).
urllib.parse.quote_from_bytes
Python Library Documentation: function quote_from_bytes in module urllib.parse
quote_from_bytes(bs, safe='/')
Like quote(), but accepts a bytes object rather than a str, and does
not perform string-to-bytes encoding. It always returns an ASCII string.
quote_from_bytes(b'abc def?') -> 'abc%20def%3f'
urllib.parse.quote_plus
Python Library Documentation: function quote_plus in module urllib.parse
quote_plus(string, safe='', encoding=None, errors=None)
Like quote(), but also replace ' ' with '+', as required for quoting
HTML form values. Plus signs in the original string are escaped unless
they are included in safe. It also does not have safe default to '/'.
urllib.parse.re
Python Library Documentation: package re
NAME
re - Support for regular expressions (RE).
MODULE REFERENCE
https://docs.python.org/3.12/library/re.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
This module provides regular expression matching operations similar to
those found in Perl. It supports both 8-bit and Unicode strings; both
the pattern and the strings being processed can contain null bytes and
characters outside the US ASCII range.
Regular expressions can contain both special and ordinary characters.
Most ordinary characters, like "A", "a", or "0", are the simplest
regular expressions; they simply match themselves. You can
concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at
the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
"?" Matches 0 or 1 (greedy) of the preceding RE.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.
A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.
The contents can be retrieved or matched later in the string.
(?aiLmsux) The letters set the corresponding flags defined below.
(?:...) Non-grouping version of regular parentheses.
(?P<name>...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).
(?<!...) Matches if not preceded by ... (must be fixed length).
(?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
the (optional) no pattern otherwise.
The special sequences consist of "\\" and a character from the list
below. If the ordinary character is not on the list, then the
resulting RE will match the second character.
\number Matches the contents of the group of the same number.
\A Matches only at the start of the string.
\Z Matches only at the end of the string.
\b Matches the empty string, but only at the start or end of a word.
\B Matches the empty string, but not at the start or end of a word.
\d Matches any decimal digit; equivalent to the set [0-9] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode digits.
\D Matches any non-digit character; equivalent to [^\d].
\s Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the whole
range of Unicode whitespace characters.
\S Matches any non-whitespace character; equivalent to [^\s].
\w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
in bytes patterns or string patterns with the ASCII flag.
In string patterns without the ASCII flag, it will match the
range of Unicode alphanumeric characters (letters plus digits
plus underscore).
With LOCALE, it will match the set [0-9_] plus characters defined
as letters for the current locale.
\W Matches the complement of \w.
\\ Matches a literal backslash.
This module exports the following functions:
match Match a regular expression pattern to the beginning of a string.
fullmatch Match a regular expression pattern to all of a string.
search Search a string for the presence of a pattern.
sub Substitute occurrences of a pattern found in a string.
subn Same as sub, but also return the number of substitutions made.
split Split a string by the occurrences of a pattern.
findall Find all occurrences of a pattern in a string.
finditer Return an iterator yielding a Match object for each match.
compile Compile a pattern into a Pattern object.
purge Clear the regular expression cache.
escape Backslash all non-alphanumerics in a string.
Each function other than purge and escape can take an optional 'flags' argument
consisting of one or more of the following module constants, joined by "|".
A, L, and U are mutually exclusive.
A ASCII For string patterns, make \w, \W, \b, \B, \d, \D
match the corresponding ASCII character categories
(rather than the whole Unicode categories, which is the
default).
For bytes patterns, this flag is the only available
behaviour and needn't be specified.
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE For compatibility only. Ignored for string patterns (it
is the default), and forbidden for bytes patterns.
This module also defines an exception 'error'.
PACKAGE CONTENTS
_casefix
_compiler
_constants
_parser
CLASSES
builtins.Exception(builtins.BaseException)
error
builtins.object
Match
Pattern
enum.IntFlag(builtins.int, enum.ReprEnum, enum.Flag)
RegexFlag
class Match(builtins.object)
| The result of re.match() and re.search().
| Match objects always have a boolean value of True.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __getitem__(self, key, /)
| Return self[key].
|
| __repr__(self, /)
| Return repr(self).
|
| end(self, group=0, /)
| Return index of the end of the substring matched by group.
|
| expand(self, /, template)
| Return the string obtained by doing backslash substitution on the string template, as done by the sub() method.
|
| group(...)
| group([group1, ...]) -> str or tuple.
| Return subgroup(s) of the match by indices or names.
| For 0 returns the entire match.
|
| groupdict(self, /, default=None)
| Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name.
|
| default
| Is used for groups that did not participate in the match.
|
| groups(self, /, default=None)
| Return a tuple containing all the subgroups of the match, from 1.
|
| default
| Is used for groups that did not participate in the match.
|
| span(self, group=0, /)
| For match object m, return the 2-tuple (m.start(group), m.end(group)).
|
| start(self, group=0, /)
| Return index of the start of the substring matched by group.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| endpos
| The index into the string beyond which the RE engine will not go.
|
| lastgroup
| The name of the last matched capturing group.
|
| lastindex
| The integer index of the last matched capturing group.
|
| pos
| The index into the string at which the RE engine started looking for a match.
|
| re
| The regular expression object.
|
| regs
|
| string
| The string passed to match() or search().
class Pattern(builtins.object)
| Compiled regular expression object.
|
| Methods defined here:
|
| __copy__(self, /)
|
| __deepcopy__(self, memo, /)
|
| __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).
|
| findall(self, /, string, pos=0, endpos=9223372036854775807)
| Return a list of all non-overlapping matches of pattern in string.
|
| finditer(self, /, string, pos=0, endpos=9223372036854775807)
| Return an iterator over all non-overlapping matches for the RE pattern in string.
|
| For each match, the iterator returns a match object.
|
| fullmatch(self, /, string, pos=0, endpos=9223372036854775807)
| Matches against all of the string.
|
| match(self, /, string, pos=0, endpos=9223372036854775807)
| Matches zero or more characters at the beginning of the string.
|
| scanner(self, /, string, pos=0, endpos=9223372036854775807)
|
| search(self, /, string, pos=0, endpos=9223372036854775807)
| Scan through string looking for a match, and return a corresponding match object instance.
|
| Return None if no position in the string matches.
|
| split(self, /, string, maxsplit=0)
| Split string by the occurrences of pattern.
|
| sub(self, /, repl, string, count=0)
| Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
|
| subn(self, /, repl, string, count=0)
| Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| flags
| The regex matching flags.
|
| groupindex
| A dictionary mapping group names to group numbers.
|
| groups
| The number of capturing groups in the pattern.
|
| pattern
| The pattern string from which the RE object was compiled.
class RegexFlag(enum.IntFlag)
| RegexFlag(*values)
|
| An enumeration.
|
| Method resolution order:
| RegexFlag
| 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)
|
| __repr__ = global_flag_repr(self) from enum
| use module.flag_name instead of class.flag_name
|
| the module is the last module in case of a multi-module name
|
| __ror__ = __or__(self, other)
|
| __rxor__ = __xor__(self, other)
|
| __str__(self, /) from builtins.object
| Return str(self).
|
| __xor__(self, other) from enum.Flag
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ASCII = re.ASCII
|
| DEBUG = re.DEBUG
|
| DOTALL = re.DOTALL
|
| IGNORECASE = re.IGNORECASE
|
| LOCALE = re.LOCALE
|
| MULTILINE = re.MULTILINE
|
| TEMPLATE = re.TEMPLATE
|
| UNICODE = re.UNICODE
|
| VERBOSE = re.VERBOSE
|
| ----------------------------------------------------------------------
| 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 error(builtins.Exception)
| error(msg, pattern=None, pos=None)
|
| Exception raised for invalid regular expressions.
|
| Attributes:
|
| msg: The unformatted error message
| pattern: The regular expression pattern
| pos: The index in the pattern where compilation failed (may be None)
| lineno: The line corresponding to pos (may be None)
| colno: The column corresponding to pos (may be None)
|
| Method resolution order:
| error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg, pattern=None, pos=None) from re._constants.error
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| 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
FUNCTIONS
compile(pattern, flags=0)
Compile a regular expression pattern, returning a Pattern object.
escape(pattern)
Escape special characters in a string.
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
finditer(pattern, string, flags=0)
Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a Match object.
Empty matches are included in the result.
fullmatch(pattern, string, flags=0)
Try to apply the pattern to all of the string, returning
a Match object, or None if no match was found.
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a Match object, or None if no match was found.
purge()
Clear the regular expression caches
search(pattern, string, flags=0)
Scan through string looking for a match to the pattern, returning
a Match object, or None if no match was found.
split(pattern, string, maxsplit=0, flags=0)
Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings. If
capturing parentheses are used in pattern, then the text of all
groups in the pattern are also returned as part of the resulting
list. If maxsplit is nonzero, at most maxsplit splits occur,
and the remainder of the string is returned as the final element
of the list.
sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash escapes in it are processed. If it is
a callable, it's passed the Match object and must return
a replacement string to be used.
subn(pattern, repl, string, count=0, flags=0)
Return a 2-tuple containing (new_string, number).
new_string is the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in the source
string by the replacement repl. number is the number of
substitutions that were made. repl can be either a string or a
callable; if a string, backslash escapes in it are processed.
If it is a callable, it's passed the Match object and must
return a replacement string to be used.
template(pattern, flags=0)
Compile a template pattern, returning a Pattern object, deprecated
DATA
A = re.ASCII
ASCII = re.ASCII
DOTALL = re.DOTALL
I = re.IGNORECASE
IGNORECASE = re.IGNORECASE
L = re.LOCALE
LOCALE = re.LOCALE
M = re.MULTILINE
MULTILINE = re.MULTILINE
NOFLAG = re.NOFLAG
S = re.DOTALL
U = re.UNICODE
UNICODE = re.UNICODE
VERBOSE = re.VERBOSE
X = re.VERBOSE
__all__ = ['match', 'fullmatch', 'search', 'sub', 'subn', 'split', 'fi...
VERSION
2.2.1
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\re\__init__.py
urllib.parse.scheme_chars
Error rendering doc: No Python documentation found for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.'. Use help() to get the interactive help utility. Use help(str) for help on the str class.
urllib.parse.splitattr
Python Library Documentation: function splitattr in module urllib.parse splitattr(url)
urllib.parse.splithost
Python Library Documentation: function splithost in module urllib.parse splithost(url)
urllib.parse.splitnport
Python Library Documentation: function splitnport in module urllib.parse splitnport(host, defport=-1)
urllib.parse.splitpasswd
Python Library Documentation: function splitpasswd in module urllib.parse splitpasswd(user)
urllib.parse.splitport
Python Library Documentation: function splitport in module urllib.parse splitport(host)
urllib.parse.splitquery
Python Library Documentation: function splitquery in module urllib.parse splitquery(url)
urllib.parse.splittag
Python Library Documentation: function splittag in module urllib.parse splittag(url)
urllib.parse.splittype
Python Library Documentation: function splittype in module urllib.parse splittype(url)
urllib.parse.splituser
Python Library Documentation: function splituser in module urllib.parse splituser(host)
urllib.parse.splitvalue
Python Library Documentation: function splitvalue in module urllib.parse splitvalue(attr)
urllib.parse.to_bytes
Python Library Documentation: function to_bytes in module urllib.parse to_bytes(url)
urllib.parse.types
Python Library Documentation: module types
NAME
types - Define names for built-in types that aren't directly accessible as a builtin.
MODULE REFERENCE
https://docs.python.org/3.12/library/types.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
builtins.NoneType
builtins.NotImplementedType
builtins.async_generator
builtins.builtin_function_or_method
builtins.cell
builtins.classmethod_descriptor
builtins.code
builtins.coroutine
builtins.ellipsis
builtins.frame
builtins.function
builtins.generator
builtins.getset_descriptor
builtins.mappingproxy
builtins.member_descriptor
builtins.method
builtins.method-wrapper
builtins.method_descriptor
builtins.module
builtins.traceback
builtins.wrapper_descriptor
DynamicClassAttribute
GenericAlias
SimpleNamespace
UnionType
AsyncGeneratorType = class async_generator(object)
| Methods defined here:
|
| __aiter__(self, /)
| Return an awaitable, that resolves in asynchronous iterator.
|
| __anext__(self, /)
| Return a value or raise StopAsyncIteration.
|
| __del__(...)
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(...)
| gen.__sizeof__() -> size of gen in memory, in bytes
|
| aclose(...)
| aclose() -> raise GeneratorExit inside generator.
|
| asend(...)
| asend(v) -> send 'v' in generator.
|
| athrow(...)
| athrow(value)
| athrow(type[,value[,tb]])
|
| raise exception in generator.
| the (type, val, tb) signature is deprecated,
| and may be removed in a future version of Python.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| ag_await
| object being awaited on, or None
|
| ag_code
|
| ag_frame
|
| ag_running
|
| ag_suspended
BuiltinFunctionType = class builtin_function_or_method(object)
| Built-in subclasses:
| builtin_method
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __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.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __self__
|
| __text_signature__
BuiltinMethodType = class builtin_function_or_method(object)
| Built-in subclasses:
| builtin_method
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __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.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __self__
|
| __text_signature__
CellType = class cell(object)
| Create a new cell object.
|
| contents
| the contents of the cell. If not specified, the cell will be empty,
| and
| further attempts to access its cell_contents attribute will
| raise a ValueError.
|
| Methods defined here:
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __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.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| cell_contents
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
ClassMethodDescriptorType = class classmethod_descriptor(object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
|
| __text_signature__
CodeType = class code(object)
| CodeType(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, qualname, firstlineno, linetable, exceptiontable, freevars=(), cellvars=(), /)
|
| Create a code object. Not for the faint of heart.
|
| Methods defined here:
|
| __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).
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| co_lines(...)
|
| co_positions(...)
|
| replace(self, /, **changes)
| Return a copy of the code object with new values for the specified fields.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| co_argcount
|
| co_cellvars
|
| co_code
|
| co_consts
|
| co_exceptiontable
|
| co_filename
|
| co_firstlineno
|
| co_flags
|
| co_freevars
|
| co_kwonlyargcount
|
| co_linetable
|
| co_lnotab
|
| co_name
|
| co_names
|
| co_nlocals
|
| co_posonlyargcount
|
| co_qualname
|
| co_stacksize
|
| co_varnames
CoroutineType = class coroutine(object)
| Methods defined here:
|
| __await__(self, /)
| Return an iterator to be used in await expression.
|
| __del__(...)
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(...)
| gen.__sizeof__() -> size of gen in memory, in bytes
|
| close(...)
| close() -> raise GeneratorExit inside coroutine.
|
| send(...)
| send(arg) -> send 'arg' into coroutine,
| return next iterated value or raise StopIteration.
|
| throw(...)
| throw(value)
| throw(type[,value[,traceback]])
|
| Raise exception in coroutine, return next iterated value or raise
| StopIteration.
| the (type, val, tb) signature is deprecated,
| and may be removed in a future version of Python.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| cr_await
| object being awaited on, or None
|
| cr_code
|
| cr_frame
|
| cr_origin
|
| cr_running
|
| cr_suspended
class DynamicClassAttribute(builtins.object)
| DynamicClassAttribute(fget=None, fset=None, fdel=None, doc=None)
|
| Route attribute access on a class to __getattr__.
|
| This is a descriptor, used to define attributes that act differently when
| accessed through an instance and through a class. Instance access remains
| normal, but access to an attribute through a class will be routed to the
| class's __getattr__ method; this is done by raising AttributeError.
|
| This allows one to have properties active on an instance, and have virtual
| attributes on the class with the same name. (Enum used this between Python
| versions 3.4 - 3.9 .)
|
| Subclass from this to use a different method of accessing virtual attributes
| and still be treated properly by the inspect module. (Enum uses this since
| Python 3.10 .)
|
| Methods defined here:
|
| __delete__(self, instance)
|
| __get__(self, instance, ownerclass=None)
|
| __init__(self, fget=None, fset=None, fdel=None, doc=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __set__(self, instance, value)
|
| deleter(self, fdel)
|
| getter(self, fget)
|
| setter(self, fset)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
EllipsisType = class ellipsis(object)
| Methods defined here:
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
FrameType = class frame(object)
| Methods defined here:
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(...)
| F.__sizeof__() -> size of F in memory, in bytes
|
| clear(...)
| F.clear(): clear most references held by the frame
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| f_back
|
| f_builtins
|
| f_code
|
| f_globals
|
| f_lasti
|
| f_lineno
|
| f_locals
|
| f_trace
|
| f_trace_lines
|
| f_trace_opcodes
FunctionType = class function(object)
| FunctionType(code, globals, name=None, argdefs=None, closure=None)
|
| Create a function object.
|
| code
| a code object
| globals
| the globals dictionary
| name
| a string that overrides the name from the code object
| argdefs
| a tuple that specifies the default argument values
| closure
| a tuple that supplies the bindings for free variables
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __annotations__
|
| __closure__
|
| __code__
|
| __defaults__
|
| __dict__
|
| __globals__
|
| __kwdefaults__
|
| __type_params__
GeneratorType = class generator(object)
| Methods defined here:
|
| __del__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(...)
| gen.__sizeof__() -> size of gen in memory, in bytes
|
| close(...)
| close() -> raise GeneratorExit inside generator.
|
| send(...)
| send(arg) -> send 'arg' into generator,
| return next yielded value or raise StopIteration.
|
| throw(...)
| throw(value)
| throw(type[,value[,tb]])
|
| Raise exception in generator, return next yielded value or raise
| StopIteration.
| the (type, val, tb) signature is deprecated,
| and may be removed in a future version of Python.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| gi_code
|
| gi_frame
|
| gi_running
|
| gi_suspended
|
| gi_yieldfrom
| object being iterated by yield from, or None
class GenericAlias(builtins.object)
| Represent a PEP 585 generic type
|
| E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __dir__(...)
| Default dir() implementation.
|
| __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).
|
| __instancecheck__(...)
| Check if an object is an instance.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __mro_entries__(...)
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __ror__(self, value, /)
| Return value|self.
|
| __subclasscheck__(...)
| Check if a class is a subclass.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __args__
|
| __origin__
|
| __parameters__
| Type variables in the GenericAlias.
|
| __typing_unpacked_tuple_args__
|
| __unpacked__
GetSetDescriptorType = class getset_descriptor(object)
| Methods defined here:
|
| __delete__(self, instance, /)
| Delete an attribute of instance.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __repr__(self, /)
| Return repr(self).
|
| __set__(self, instance, value, /)
| Set an attribute of instance to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
LambdaType = class function(object)
| LambdaType(code, globals, name=None, argdefs=None, closure=None)
|
| Create a function object.
|
| code
| a code object
| globals
| the globals dictionary
| name
| a string that overrides the name from the code object
| argdefs
| a tuple that specifies the default argument values
| closure
| a tuple that supplies the bindings for free variables
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __annotations__
|
| __closure__
|
| __code__
|
| __defaults__
|
| __dict__
|
| __globals__
|
| __kwdefaults__
|
| __type_params__
MappingProxyType = class mappingproxy(object)
| Methods defined here:
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __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.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
| D.__reversed__() -> reverse iterator
|
| __ror__(self, value, /)
| Return value|self.
|
| __str__(self, /)
| Return str(self).
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(...)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| 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
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
MemberDescriptorType = class member_descriptor(object)
| Methods defined here:
|
| __delete__(self, instance, /)
| Delete an attribute of instance.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __set__(self, instance, value, /)
| Set an attribute of instance to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
MethodDescriptorType = class method_descriptor(object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
|
| __text_signature__
MethodType = class method(object)
| MethodType(function, instance, /)
|
| Create a bound instance method object.
|
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __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.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reduce__(self, /)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __func__
| the function (or other callable) implementing a method
|
| __self__
| the instance to which a method is bound
MethodWrapperType = class method-wrapper(object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __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.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
|
| __self__
|
| __text_signature__
ModuleType = class module(object)
| ModuleType(name, doc=None)
|
| Create a module object.
|
| The name must be a string; the optional doc argument can have any type.
|
| Methods defined here:
|
| __dir__(...)
| __dir__() -> list
| specialized dir() implementation
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __annotations__
|
| __dict__
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.
class NotImplementedType(object)
| Methods defined here:
|
| __bool__(self, /)
| True if self else False
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
class SimpleNamespace(builtins.object)
| A simple attribute-based namespace.
|
| SimpleNamespace(**kwargs)
|
| Methods defined here:
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reduce__(...)
| Return state information for pickling
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
TracebackType = class traceback(object)
| TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)
| --
|
| Create a new traceback object.
|
| Methods defined here:
|
| __dir__(...)
| Default dir() implementation.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| tb_frame
|
| tb_lasti
|
| tb_lineno
|
| tb_next
class UnionType(builtins.object)
| Represent a PEP 604 union type
|
| E.g. for int | str
|
| Methods defined here:
|
| __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).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __repr__(self, /)
| Return repr(self).
|
| __ror__(self, value, /)
| Return value|self.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __args__
|
| __parameters__
| Type variables in the types.UnionType.
WrapperDescriptorType = class wrapper_descriptor(object)
| Methods defined here:
|
| __call__(self, /, *args, **kwargs)
| Call self as a function.
|
| __get__(self, instance, owner=None, /)
| Return an attribute of instance, which is of type owner.
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __objclass__
|
| __text_signature__
FUNCTIONS
coroutine(func)
Convert regular generator function to a coroutine.
get_original_bases(cls, /)
Return the class's "original" bases prior to modification by `__mro_entries__`.
Examples::
from typing import TypeVar, Generic, NamedTuple, TypedDict
T = TypeVar("T")
class Foo(Generic[T]): ...
class Bar(Foo[int], float): ...
class Baz(list[str]): ...
Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
Spam = TypedDict("Spam", {"a": int, "b": str})
assert get_original_bases(Bar) == (Foo[int], float)
assert get_original_bases(Baz) == (list[str],)
assert get_original_bases(Eggs) == (NamedTuple,)
assert get_original_bases(Spam) == (TypedDict,)
assert get_original_bases(int) == (object,)
new_class(name, bases=(), kwds=None, exec_body=None)
Create a class object dynamically using the appropriate metaclass.
prepare_class(name, bases=(), kwds=None)
Call the __prepare__ method of the appropriate metaclass.
Returns (metaclass, namespace, kwds) as a 3-tuple
*metaclass* is the appropriate metaclass
*namespace* is the prepared class namespace
*kwds* is an updated copy of the passed in kwds argument with any
'metaclass' entry removed. If no kwds argument is passed in, this will
be an empty dict.
resolve_bases(bases)
Resolve MRO entries dynamically as specified by PEP 560.
DATA
__all__ = ['FunctionType', 'LambdaType', 'CodeType', 'MappingProxyType...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\types.py
urllib.parse.unquote
Python Library Documentation: function unquote in module urllib.parse
unquote(string, encoding='utf-8', errors='replace')
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences into Unicode characters, as accepted by the bytes.decode()
method.
By default, percent-encoded sequences are decoded with UTF-8, and invalid
sequences are replaced by a placeholder character.
unquote('abc%20def') -> 'abc def'.
urllib.parse.unquote_plus
Python Library Documentation: function unquote_plus in module urllib.parse
unquote_plus(string, encoding='utf-8', errors='replace')
Like unquote(), but also replace plus signs by spaces, as required for
unquoting HTML form values.
unquote_plus('%7e/abc+def') -> '~/abc def'
urllib.parse.unquote_to_bytes
Python Library Documentation: function unquote_to_bytes in module urllib.parse
unquote_to_bytes(string)
unquote_to_bytes('abc%20def') -> b'abc def'.
urllib.parse.unwrap
Python Library Documentation: function unwrap in module urllib.parse
unwrap(url)
Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'.
The string is returned unchanged if it's not a wrapped URL.
urllib.parse.urldefrag
Python Library Documentation: function urldefrag in module urllib.parse
urldefrag(url)
Removes any existing fragment from URL.
Returns a tuple of the defragmented URL and the fragment. If
the URL contained no fragments, the second element is the
empty string.
urllib.parse.urlencode
Python Library Documentation: function urlencode in module urllib.parse
urlencode(query, doseq=False, safe='', encoding=None, errors=None, quote_via=<function quote_plus at 0x000001D7281EC220>)
Encode a dict or sequence of two-element tuples into a URL query string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the order of the
parameters in the output will match the order of parameters in the
input.
The components of a query arg may each be either a string or a bytes type.
The safe, encoding, and errors parameters are passed down to the function
specified by quote_via (encoding and errors only if a component is a str).
urllib.parse.urljoin
Python Library Documentation: function urljoin in module urllib.parse
urljoin(base, url, allow_fragments=True)
Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
urllib.parse.urlparse
Python Library Documentation: function urlparse in module urllib.parse
urlparse(url, scheme='', allow_fragments=True)
Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
The result is a named 6-tuple with fields corresponding to the
above. It is either a ParseResult or ParseResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urllib.parse.urlsplit
Python Library Documentation: _lru_cache_wrapper in module urllib.parse
urlsplit(url, scheme='', allow_fragments=True)
Parse a URL into 5 components:
<scheme>://<netloc>/<path>?<query>#<fragment>
The result is a named 5-tuple with fields corresponding to the
above. It is either a SplitResult or SplitResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
urllib.parse.urlunparse
Python Library Documentation: function urlunparse in module urllib.parse
urlunparse(components)
Put a parsed URL back together again. This may result in a
slightly different, but equivalent URL, if the URL that was parsed
originally had redundant delimiters, e.g. a ? with an empty query
(the draft states that these are equivalent).
urllib.parse.urlunsplit
Python Library Documentation: function urlunsplit in module urllib.parse
urlunsplit(components)
Combine the elements of a tuple as returned by urlsplit() into a
complete URL as a string. The data argument can be any five-item iterable.
This may result in a slightly different, but equivalent URL, if the URL that
was parsed originally had unnecessary delimiters (for example, a ? with an
empty query; the RFC states that these are equivalent).
urllib.parse.uses_fragment
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.uses_netloc
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.uses_params
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.uses_query
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.uses_relative
Python Library Documentation: list object class list(object) | list(iterable=(), /) | | Built-in mutable sequence. | | If no argument is given, the constructor creates a new empty list. | The argument must be an iterable if specified. | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return bool(key in self). | | __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). | | __getitem__(self, index, /) | Return self[index]. | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __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. | | __repr__(self, /) | Return repr(self). | | __reversed__(self, /) | Return a reverse iterator over the list. | | __rmul__(self, value, /) | Return value*self. | | __setitem__(self, key, value, /) | Set self[key] to value. | | __sizeof__(self, /) | Return the size of the list in memory, in bytes. | | append(self, object, /) | Append object to the end of the list. | | clear(self, /) | Remove all items from list. | | copy(self, /) | Return a shallow copy of the list. | | count(self, value, /) | Return number of occurrences of value. | | extend(self, iterable, /) | Extend list by appending elements from the iterable. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | insert(self, index, object, /) | Insert object before index. | | pop(self, index=-1, /) | Remove and return item at index (default last). | | Raises IndexError if list is empty or index is out of range. | | remove(self, value, /) | Remove first occurrence of value. | | Raises ValueError if the value is not present. | | reverse(self, /) | Reverse *IN PLACE*. | | sort(self, /, *, key=None, reverse=False) | Sort the list in ascending order and return None. | | The sort is in-place (i.e. the list itself is modified) and stable (i.e. the | order of two equal elements is maintained). | | If a key function is given, apply it once to each list item and sort them, | ascending or descending, according to their function values. | | The reverse flag can be set to sort in descending order. | | ---------------------------------------------------------------------- | Class methods defined here: | | __class_getitem__(...) | See PEP 585 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(*args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __hash__ = None
urllib.parse.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
urllib.error.ContentTooShortError
Python Library Documentation: class ContentTooShortError in module urllib.error class ContentTooShortError(URLError) | ContentTooShortError(message, content) | | Exception raised when downloaded size does not match content-length. | | Method resolution order: | ContentTooShortError | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, message, content) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from URLError: | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors inherited from URLError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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
urllib.error.HTTPError
Python Library Documentation: class HTTPError in module urllib.error class HTTPError(URLError, urllib.response.addinfourl) | HTTPError(url, code, msg, hdrs, fp) | | Raised when HTTP error occurs, but also acts like non-error return | | Method resolution order: | HTTPError | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | urllib.response.addinfourl | urllib.response.addinfo | urllib.response.addbase | tempfile._TemporaryFileWrapper | builtins.object | | Methods defined here: | | __init__(self, url, code, msg, hdrs, fp) | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Readonly properties defined here: | | reason | | ---------------------------------------------------------------------- | Data descriptors defined here: | | headers | | ---------------------------------------------------------------------- | Data descriptors inherited from URLError: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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). | | __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 | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addinfourl: | | getcode(self) | | geturl(self) | | ---------------------------------------------------------------------- | Readonly properties inherited from urllib.response.addinfourl: | | status | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addinfo: | | info(self) | | ---------------------------------------------------------------------- | Methods inherited from urllib.response.addbase: | | __enter__(self) | | __exit__(self, type, value, traceback) | | ---------------------------------------------------------------------- | Methods inherited from tempfile._TemporaryFileWrapper: | | __getattr__(self, name) | | __iter__(self) | # iter() doesn't use __getattr__ to find the __iter__ method | | close(self) | Close the temporary file, possibly deleting it.
urllib.error.URLError
Python Library Documentation: class URLError in module urllib.error class URLError(builtins.OSError) | URLError(reason, filename=None) | | Method resolution order: | URLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, reason, filename=None) | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __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
urllib.error.io
Python Library Documentation: module io
NAME
io
MODULE REFERENCE
https://docs.python.org/3.12/library/io.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
The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
allowed to raise an OSError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
an interface to OS files.
BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
streams that are readable, writable, and both respectively.
BufferedRandom provides a buffered interface to random access
streams. BytesIO is a simple stream of in-memory bytes.
Another IOBase subclass, TextIOBase, deals with the encoding and decoding
of streams into text. TextIOWrapper, which extends it, is a buffered text
interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
is an in-memory stream for text.
Argument names are not part of the specification, and only the arguments
of open() are intended to be used as keyword arguments.
data:
DEFAULT_BUFFER_SIZE
An int containing the default buffer size used by the module's buffered
I/O classes. open() uses the file's blksize (as obtained by os.stat) if
possible.
CLASSES
_io._BufferedIOBase(_io._IOBase)
_io.BufferedRWPair
_io.BufferedRandom
_io.BufferedReader
_io.BufferedWriter
_io.BytesIO
BufferedIOBase(_io._BufferedIOBase, IOBase)
_io._IOBase(builtins.object)
IOBase
BufferedIOBase(_io._BufferedIOBase, IOBase)
RawIOBase(_io._RawIOBase, IOBase)
TextIOBase(_io._TextIOBase, IOBase)
_io._RawIOBase(_io._IOBase)
_io.FileIO
RawIOBase(_io._RawIOBase, IOBase)
_io._TextIOBase(_io._IOBase)
_io.StringIO
_io.TextIOWrapper
TextIOBase(_io._TextIOBase, IOBase)
builtins.OSError(builtins.Exception)
builtins.BlockingIOError
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.ValueError(builtins.Exception)
UnsupportedOperation(builtins.OSError, builtins.ValueError)
builtins.object
_io.IncrementalNewlineDecoder
class BlockingIOError(OSError)
| I/O operation would block.
|
| Method resolution order:
| BlockingIOError
| OSError
| Exception
| BaseException
| object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from OSError:
|
| __reduce__(...)
| Helper for pickle.
|
| __str__(self, /)
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from 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 OSError:
|
| characters_written
|
| errno
| POSIX exception code
|
| filename
| exception filename
|
| filename2
| second exception filename
|
| strerror
| exception strerror
|
| winerror
| Win32 exception code
|
| ----------------------------------------------------------------------
| Methods inherited from 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 BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class BufferedIOBase(_io._BufferedIOBase, IOBase)
| Base class for buffered IO objects.
|
| The main difference with RawIOBase is that the read() method
| supports omitting the size argument, and does not have a default
| implementation that defers to readinto().
|
| In addition, read(), readinto() and write() may raise
| BlockingIOError if the underlying raw stream is in non-blocking
| mode and not ready; unlike their raw counterparts, they will never
| return None.
|
| A typical implementation should not inherit from a RawIOBase
| implementation, but wrap one.
|
| Method resolution order:
| BufferedIOBase
| _io._BufferedIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 BufferedRWPair(_BufferedIOBase)
| BufferedRWPair(reader, writer, buffer_size=8192, /)
|
| A buffered reader and writer object together.
|
| A buffered reader object and buffered writer object put together to
| form a sequential IO object that can read and write. This is typically
| used with a socket or two-way pipe.
|
| reader and writer are RawIOBase objects that are readable and
| writeable respectively. If the buffer_size is omitted it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRWPair
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| close(...)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| flush(...)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| isatty(...)
| Return whether this is an 'interactive' stream.
|
| Return False if it can't be determined.
|
| peek(...)
|
| read(...)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(...)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(...)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(...)
|
| readinto1(...)
|
| writable(...)
| Return whether object was opened for writing.
|
| If False, write() will raise OSError.
|
| write(...)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| ----------------------------------------------------------------------
| Methods inherited from _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.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedRandom(_BufferedIOBase)
| BufferedRandom(raw, buffer_size=8192)
|
| A buffered interface to random access streams.
|
| The constructor creates a reader and writer for a seekable stream,
| raw, given in the first argument. If the buffer_size is omitted it
| defaults to DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedRandom
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedReader(_BufferedIOBase)
| BufferedReader(raw, buffer_size=8192)
|
| Create a new buffered reader using the given readable raw IO object.
|
| Method resolution order:
| BufferedReader
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| peek(self, size=0, /)
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| write(self, b, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BufferedWriter(_BufferedIOBase)
| BufferedWriter(raw, buffer_size=8192)
|
| A buffer for a writeable sequential RawIO object.
|
| The constructor creates a BufferedWriter for the given writeable raw
| stream. If the buffer_size is not given, it defaults to
| DEFAULT_BUFFER_SIZE.
|
| Method resolution order:
| BufferedWriter
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __sizeof__(self, /)
| Size of object in memory, in bytes.
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| 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.
|
| seek(self, target, 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, pos=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.
|
| write(self, buffer, /)
| Write buffer b to the IO stream.
|
| Return the number of bytes written, which is always
| the length of b in bytes.
|
| Raise BlockingIOError if the buffer is full and the
| underlying raw stream cannot accept more data at the moment.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| mode
|
| name
|
| raw
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| read(self, size=-1, /)
| Read and return up to n bytes.
|
| If the size argument is omitted, None, or negative, read and
| return all data until EOF.
|
| If the size argument is positive, and the underlying raw stream is
| not 'interactive', multiple raw reads may be issued to satisfy
| the byte count (unless EOF is reached first).
| However, for interactive raw streams (as well as sockets and pipes),
| at most one raw read will be issued, and a short result does not
| imply that EOF is imminent.
|
| Return an empty bytes object on EOF.
|
| Return None if the underlying raw stream was open in non-blocking
| mode and no data is available at the moment.
|
| read1(self, size=-1, /)
| Read and return up to size bytes, with at most one read() call to the underlying raw stream.
|
| Return an empty bytes object on EOF.
| A short result does not imply that EOF is imminent.
|
| readinto(self, buffer, /)
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class BytesIO(_BufferedIOBase)
| BytesIO(initial_bytes=b'')
|
| Buffered I/O implementation using an in-memory bytes buffer.
|
| Method resolution order:
| BytesIO
| _BufferedIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| __sizeof__(...)
| Size of object in memory, in bytes.
|
| close(self, /)
| Disable all I/O operations.
|
| flush(self, /)
| Does nothing.
|
| getbuffer(self, /)
| Get a read-write view over the contents of the BytesIO object.
|
| getvalue(self, /)
| Retrieve the entire contents of the BytesIO object.
|
| isatty(self, /)
| Always returns False.
|
| BytesIO objects are not connected to a TTY-like device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| read1(self, size=-1, /)
| Read at most size bytes, returned as a bytes object.
|
| If the size argument is negative or omitted, read until EOF is reached.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readinto(self, buffer, /)
| Read bytes into buffer.
|
| Returns number of bytes read (0 for EOF), or None if the object
| is set not to block and has no data to read.
|
| readline(self, size=-1, /)
| Next line from the file, as a bytes object.
|
| Retain newline. A non-negative size argument limits the maximum
| number of bytes to return (an incomplete line may be returned then).
| Return an empty bytes object at EOF.
|
| readlines(self, size=None, /)
| List of bytes objects, each a line from the file.
|
| Call readline() repeatedly and return a list of the lines so read.
| The optional size argument, if given, is an approximate bound on the
| total number of bytes in the lines returned.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to byte offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos may be negative;
| 2 End of stream - pos usually negative.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Current file position, an integer.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is unchanged. Returns the new size.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, b, /)
| Write bytes to file.
|
| Return the number of bytes written.
|
| writelines(self, lines, /)
| Write lines to the file.
|
| Note that newlines are not added. lines can be any iterable object
| producing bytes-like objects. This is equivalent to calling write() for
| each element.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed.
|
| ----------------------------------------------------------------------
| Methods inherited from _BufferedIOBase:
|
| detach(self, /)
| Disconnect this buffer from its underlying raw stream and return it.
|
| After the raw stream has been detached, the buffer is in an unusable
| state.
|
| readinto1(self, buffer, /)
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| fileno(self, /)
| Return underlying file descriptor if one exists.
|
| Raise OSError if the IO object does not use a file descriptor.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _IOBase:
|
| __dict__
class FileIO(_RawIOBase)
| FileIO(file, mode='r', closefd=True, opener=None)
|
| Open a file.
|
| The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
| writing, exclusive creation or appending. The file will be created if it
| doesn't exist when opened for writing or appending; it will be truncated
| when opened for writing. A FileExistsError will be raised if it already
| exists when opened for creating. Opening a file for creating implies
| writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
| to allow simultaneous reading and writing. A custom opener can be used by
| passing a callable as *opener*. The underlying file descriptor for the file
| object is then obtained by calling opener with (*name*, *flags*).
| *opener* must return an open file descriptor (passing os.open as *opener*
| results in functionality similar to passing None).
|
| Method resolution order:
| FileIO
| _RawIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Close the file.
|
| A closed file cannot be used for further I/O operations. close() may be
| called more than once without error.
|
| fileno(self, /)
| Return the underlying file descriptor (an integer).
|
| isatty(self, /)
| True if the file is connected to a TTY device.
|
| read(self, size=-1, /)
| Read at most size bytes, returned as bytes.
|
| Only makes one system call, so less data may be returned than requested.
| In non-blocking mode, returns None if no data is available.
| Return an empty bytes object at EOF.
|
| readable(self, /)
| True if file was opened in a read mode.
|
| readall(self, /)
| Read all data from the file, returned as bytes.
|
| In non-blocking mode, returns as much as is immediately available,
| or None if no data is available. Return an empty bytes object at EOF.
|
| readinto(self, buffer, /)
| Same as RawIOBase.readinto().
|
| seek(self, pos, whence=0, /)
| Move to new file position and return the file position.
|
| Argument offset is a byte count. Optional argument whence defaults to
| SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
| are SEEK_CUR or 1 (move relative to current position, positive or negative),
| and SEEK_END or 2 (move relative to end of file, usually negative, although
| many platforms allow seeking beyond the end of a file).
|
| Note that not all file objects are seekable.
|
| seekable(self, /)
| True if file supports random-access.
|
| tell(self, /)
| Current file position.
|
| Can raise OSError for non seekable files.
|
| truncate(self, size=None, /)
| Truncate the file to at most size bytes and return the truncated size.
|
| Size defaults to the current file position, as returned by tell().
| The current file position is changed to the value of size.
|
| writable(self, /)
| True if file was opened in a write mode.
|
| write(self, b, /)
| Write buffer b to file, return number of bytes written.
|
| Only makes one system call, so not all of the data may be written.
| The number of bytes actually written is returned. In non-blocking mode,
| returns None if the write would block.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
| True if the file is closed
|
| closefd
| True if the file descriptor will be closed by close().
|
| mode
| String giving the file mode
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| flush(self, /)
| Flush write buffers, if applicable.
|
| This is not implemented for read-only and non-blocking streams.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class IOBase(_io._IOBase)
| The abstract base class for all I/O classes.
|
| This class provides dummy implementations for many methods that
| derived classes can override selectively; the default implementations
| represent a file that cannot be read, written or seeked.
|
| Even though IOBase does not declare read, readinto, or write because
| their signatures will vary, implementations and clients should
| consider those methods part of the interface. Also, implementations
| may raise UnsupportedOperation when operations they do not support are
| called.
|
| The basic type used for binary data read from or written to a file is
| bytes. Other bytes-like objects are accepted as method arguments too.
| In some cases (such as readinto), a writable object is required. Text
| I/O classes work with str data.
|
| Note that calling any method (except additional calls to close(),
| which are ignored) on a closed stream should raise a ValueError.
|
| IOBase (and its subclasses) support the iterator protocol, meaning
| that an IOBase object can be iterated over yielding the lines in a
| stream.
|
| IOBase also supports the :keyword:`with` statement. In this example,
| fp is closed after the suite of the with statement is complete:
|
| with open('spam.txt', 'r') as fp:
| fp.write('Spam and eggs!')
|
| Method resolution order:
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 IncrementalNewlineDecoder(builtins.object)
| IncrementalNewlineDecoder(decoder, translate, errors='strict')
|
| Codec used when reading a file in universal newlines mode.
|
| It wraps another incremental decoder, translating \r\n and \r into \n.
| It also records the types of newlines encountered. When used with
| translate=False, it ensures that the newline sequence is returned in
| one piece. When used with decoder=None, it expects unicode strings as
| decode input and translates newlines without first invoking an external
| decoder.
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| decode(self, /, input, final=False)
|
| getstate(self, /)
|
| reset(self, /)
|
| setstate(self, state, /)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| newlines
class RawIOBase(_io._RawIOBase, IOBase)
| Base class for raw binary I/O.
|
| Method resolution order:
| RawIOBase
| _io._RawIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._RawIOBase:
|
| read(self, size=-1, /)
|
| readall(self, /)
| Read until EOF, using multiple read() call.
|
| readinto(...)
|
| write(...)
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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 StringIO(_TextIOBase)
| StringIO(initial_value='', newline='\n')
|
| Text I/O implementation using an in-memory buffer.
|
| The initial_value argument sets the value of object. The newline
| argument is like the one of TextIOWrapper's constructor.
|
| Method resolution order:
| StringIO
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __getstate__(...)
| Helper for pickle.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __setstate__(...)
|
| close(self, /)
| Close the IO object.
|
| Attempting any further operation after the object is closed
| will raise a ValueError.
|
| This method has no effect if the file is already closed.
|
| getvalue(self, /)
| Retrieve the entire contents of the object.
|
| read(self, size=-1, /)
| Read at most size characters, returned as a string.
|
| If the argument is negative or omitted, read until EOF
| is reached. Return an empty string at EOF.
|
| readable(self, /)
| Returns True if the IO object can be read.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Returns an empty string if EOF is hit immediately.
|
| seek(self, pos, whence=0, /)
| Change stream position.
|
| Seek to character offset pos relative to position indicated by whence:
| 0 Start of stream (the default). pos should be >= 0;
| 1 Current position - pos must be 0;
| 2 End of stream - pos must be 0.
| Returns the new absolute position.
|
| seekable(self, /)
| Returns True if the IO object can be seeked.
|
| tell(self, /)
| Tell the current file position.
|
| truncate(self, pos=None, /)
| Truncate size to pos.
|
| The pos argument defaults to the current file position, as
| returned by tell(). The current file position is unchanged.
| Returns the new absolute position.
|
| writable(self, /)
| Returns True if the IO object can be written.
|
| write(self, s, /)
| Write string to file.
|
| Returns the number of characters written, which is always equal to
| the length of the string.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| closed
|
| line_buffering
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(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.
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class TextIOBase(_io._TextIOBase, IOBase)
| Base class for text I/O.
|
| This class provides a character and line based interface to stream
| I/O. There is no readinto method because Python's character strings
| are immutable.
|
| Method resolution order:
| TextIOBase
| _io._TextIOBase
| IOBase
| _io._IOBase
| builtins.object
|
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from _io._TextIOBase:
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| write(self, s, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _io._TextIOBase:
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| ----------------------------------------------------------------------
| Methods inherited from _io._IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| 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.
|
| 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 TextIOWrapper(_TextIOBase)
| TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False, write_through=False)
|
| Character and line based layer over a BufferedIOBase object, buffer.
|
| encoding gives the name of the encoding that the stream will be
| decoded or encoded with. It defaults to locale.getencoding().
|
| errors determines the strictness of encoding and decoding (see
| help(codecs.Codec) or the documentation for codecs.register) and
| defaults to "strict".
|
| newline controls how line endings are handled. It can be None, '',
| '\n', '\r', and '\r\n'. It works as follows:
|
| * On input, if newline is None, universal newlines mode is
| enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
| these are translated into '\n' before being returned to the
| caller. If it is '', universal newline mode is enabled, but line
| endings are returned to the caller untranslated. If it has any of
| the other legal values, input lines are only terminated by the given
| string, and the line ending is returned to the caller untranslated.
|
| * On output, if newline is None, any '\n' characters written are
| translated to the system default line separator, os.linesep. If
| newline is '' or '\n', no translation takes place. If newline is any
| of the other legal values, any '\n' characters written are translated
| to the given string.
|
| If line_buffering is True, a call to flush is implied when a call to
| write contains a newline character.
|
| Method resolution order:
| TextIOWrapper
| _TextIOBase
| _IOBase
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __next__(self, /)
| Implement next(self).
|
| __reduce__(...)
| Helper for pickle.
|
| __reduce_ex__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| close(self, /)
| Flush and close the IO object.
|
| This method has no effect if the file is already closed.
|
| detach(self, /)
| Separate the underlying buffer from the TextIOBase and return it.
|
| After the underlying buffer has been detached, the TextIO is in an unusable state.
|
| 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.
|
| read(self, size=-1, /)
| Read at most size characters from stream.
|
| Read from underlying buffer until we have size characters or we hit EOF.
| If size is negative or omitted, read until EOF.
|
| readable(self, /)
| Return whether object was opened for reading.
|
| If False, read() will raise OSError.
|
| readline(self, size=-1, /)
| Read until newline or EOF.
|
| Return an empty string if EOF is hit immediately.
| If size is specified, at most size characters will be read.
|
| reconfigure(self, /, *, encoding=None, errors=None, newline=None, line_buffering=None, write_through=None)
| Reconfigure the text stream with new parameters.
|
| This also does an implicit stream flush.
|
| seek(self, cookie, whence=0, /)
| Set the stream position, and return the new stream position.
|
| cookie
| Zero or an opaque number returned by tell().
| whence
| The relative position to seek from.
|
| Four operations are supported, given by the following argument
| combinations:
|
| - seek(0, SEEK_SET): Rewind to the start of the stream.
| - seek(cookie, SEEK_SET): Restore a previous position;
| 'cookie' must be a number returned by tell().
| - seek(0, SEEK_END): Fast-forward to the end of the stream.
| - seek(0, SEEK_CUR): Leave the current stream position unchanged.
|
| Any other argument combinations are invalid,
| and may raise exceptions.
|
| 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 the stream position as an opaque number.
|
| The return value of tell() can be given as input to seek(), to restore a
| previous stream position.
|
| truncate(self, pos=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.
|
| write(self, text, /)
| Write string s to stream.
|
| Return the number of characters written
| (which is always equal to the length of the string).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| buffer
|
| closed
|
| encoding
| Encoding of the text stream.
|
| Subclasses should override.
|
| errors
| The error setting of the decoder or encoder.
|
| Subclasses should override.
|
| line_buffering
|
| name
|
| newlines
| Line endings translated so far.
|
| Only line endings translated during reading are considered.
|
| Subclasses should override.
|
| write_through
|
| ----------------------------------------------------------------------
| Methods inherited from _IOBase:
|
| __del__(...)
|
| __enter__(...)
|
| __exit__(...)
|
| __iter__(self, /)
| Implement iter(self).
|
| 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.
|
| 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 _IOBase:
|
| __dict__
class UnsupportedOperation(builtins.OSError, builtins.ValueError)
| Method resolution order:
| UnsupportedOperation
| 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 builtins.OSError:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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
FUNCTIONS
open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
dependent: locale.getencoding() is called to get the current locale encoding.
(For reading and writing raw bytes use binary mode and leave encoding
unspecified.) The available modes are:
========= ===============================================================
Character Meaning
--------- ---------------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
'a' open for writing, appending to the end of the file if it exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
========= ===============================================================
The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
line buffering (only usable in text mode), and an integer > 1 to indicate
the size of a fixed-size chunk buffer. When no buffering argument is
given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
is chosen using a heuristic trying to determine the underlying device's
"block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
On many systems, the buffer will typically be 4096 or 8192 bytes long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
* On input, if newline is None, universal newlines mode is
enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
these are translated into '\n' before being returned to the
caller. If it is '', universal newline mode is enabled, but line
endings are returned to the caller untranslated. If it has any of
the other legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
translated to the system default line separator, os.linesep. If
newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
when the file is closed. This does not work when a file name is given
and must be True in that case.
A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
are performed. When open() is used to open a file in a text mode ('w',
'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
open_code(path)
Opens the provided file with the intent to import the contents.
This may perform extra validation beyond open(), but is otherwise interchangeable
with calling open(path, 'rb').
text_encoding(encoding, stacklevel=2, /)
A helper function to choose the text encoding.
When encoding is not None, this function returns it.
Otherwise, this function returns the default text encoding
(i.e. "locale" or "utf-8" depends on UTF-8 mode).
This function emits an EncodingWarning if encoding is None and
sys.flags.warn_default_encoding is true.
This can be used in APIs with an encoding=None parameter.
However, please consider using encoding="utf-8" for new APIs.
DATA
DEFAULT_BUFFER_SIZE = 8192
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
__all__ = ['BlockingIOError', 'open', 'open_code', 'IOBase', 'RawIOBas...
AUTHOR
Guido van Rossum <guido@python.org>, Mike Verdone <mike.verdone@gmail.com>, Mark Russell <mark.russell@zen.co.uk>, Antoine Pitrou <solipsis@pitrou.net>, Amaury Forgeot d'Arc <amauryfa@gmail.com>, Benjamin Peterson <benjamin@python.org>
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\io.py
urllib.error.urllib
Python Library Documentation: package urllib
NAME
urllib
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.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.
PACKAGE CONTENTS
error
parse
request
response
robotparser
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\__init__.py
urllib.robotparser.Entry
Python Library Documentation: class Entry in module urllib.robotparser class Entry(builtins.object) | An entry has one or more user-agents and zero or more rulelines | | Methods defined here: | | __init__(self) | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | allowance(self, filename) | Preconditions: | - our agent applies to this entry | - filename is URL decoded | | applies_to(self, useragent) | check if this entry applies to the specified agent | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.robotparser.RequestRate
Python Library Documentation: class RequestRate in module urllib.robotparser
class RequestRate(builtins.tuple)
| RequestRate(requests, seconds)
|
| RequestRate(requests, seconds)
|
| Method resolution order:
| RequestRate
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.RequestRate
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.RequestRate
| Return a nicely formatted representation string
|
| _asdict(self) from collections.RequestRate
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.RequestRate
| Return a new RequestRate object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.RequestRate
| Make a new RequestRate object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, requests, seconds) from namedtuple_RequestRate.RequestRate
| Create new instance of RequestRate(requests, seconds)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| requests
| Alias for field number 0
|
| seconds
| Alias for field number 1
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __match_args__ = ('requests', 'seconds')
|
| _field_defaults = {}
|
| _fields = ('requests', 'seconds')
|
| ----------------------------------------------------------------------
| 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
urllib.robotparser.RobotFileParser
Python Library Documentation: class RobotFileParser in module urllib.robotparser class RobotFileParser(builtins.object) | RobotFileParser(url='') | | This class provides a set of methods to read, parse and answer | questions about a single robots.txt file. | | Methods defined here: | | __init__(self, url='') | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | can_fetch(self, useragent, url) | using the parsed robots.txt decide if useragent can fetch url | | crawl_delay(self, useragent) | | modified(self) | Sets the time the robots.txt file was last fetched to the | current time. | | mtime(self) | Returns the time the robots.txt file was last fetched. | | This is useful for long-running web spiders that need to | check for new robots.txt files periodically. | | parse(self, lines) | Parse the input lines from a robots.txt file. | | We allow that a user-agent: line is not preceded by | one or more blank lines. | | read(self) | Reads the robots.txt URL and feeds it to the parser. | | request_rate(self, useragent) | | set_url(self, url) | Sets the URL referring to a robots.txt file. | | site_maps(self) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.robotparser.RuleLine
Python Library Documentation: class RuleLine in module urllib.robotparser class RuleLine(builtins.object) | RuleLine(path, allowance) | | A rule line is a single "Allow:" (allowance==True) or "Disallow:" | (allowance==False) followed by a path. | | Methods defined here: | | __init__(self, path, allowance) | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) | Return str(self). | | applies_to(self, filename) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables | | __weakref__ | list of weak references to the object
urllib.robotparser.collections
Python Library Documentation: package collections
NAME
collections
MODULE REFERENCE
https://docs.python.org/3.12/library/collections.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
This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
* namedtuple factory function for creating tuple subclasses with named fields
* deque list-like container with fast appends and pops on either end
* ChainMap dict-like class for creating a single view of multiple mappings
* Counter dict subclass for counting hashable objects
* OrderedDict dict subclass that remembers the order entries were added
* defaultdict dict subclass that calls a factory function to supply missing values
* UserDict wrapper around dictionary objects for easier dict subclassing
* UserList wrapper around list objects for easier list subclassing
* UserString wrapper around string objects for easier string subclassing
PACKAGE CONTENTS
abc
SUBMODULES
_collections_abc
CLASSES
builtins.dict(builtins.object)
Counter
OrderedDict
defaultdict
builtins.object
deque
collections.abc.MutableMapping(collections.abc.Mapping)
ChainMap
UserDict
collections.abc.MutableSequence(collections.abc.Sequence)
UserList
collections.abc.Sequence(collections.abc.Reversible, collections.abc.Collection)
UserString
class ChainMap(collections.abc.MutableMapping)
| ChainMap(*maps)
|
| A ChainMap groups multiple dicts (or other mappings) together
| to create a single, updateable view.
|
| The underlying mappings are stored in a list. That list is public and can
| be accessed or updated using the *maps* attribute. There is no other
| state.
|
| Lookups search the underlying mappings successively until a key is found.
| In contrast, writes, updates, and deletions only operate on the first
| mapping.
|
| Method resolution order:
| ChainMap
| collections.abc.MutableMapping
| collections.abc.Mapping
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __bool__(self)
|
| __contains__(self, key)
|
| __copy__ = copy(self)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, *maps)
| Initialize a ChainMap by setting *maps* to the given mappings.
| If no mappings are provided, a single empty dictionary is used.
|
| __ior__(self, other)
|
| __iter__(self)
|
| __len__(self)
|
| __missing__(self, key)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, value)
|
| clear(self)
| Clear maps[0], leaving maps[1:] intact.
|
| copy(self)
| New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| new_child(self, m=None, **kwargs)
| New ChainMap with a new map followed by all previous maps.
| If no map is provided, an empty dict is used.
| Keyword arguments update the map or new empty dict.
|
| pop(self, key, *args)
| Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].
|
| popitem(self)
| Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, *args)
| Create a ChainMap with a single dict created from the iterable.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| parents
| New ChainMap from maps[1:].
|
| ----------------------------------------------------------------------
| 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()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| 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:
|
| __eq__(self, other)
| Return self==value.
|
| 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:
|
| __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,).
class Counter(builtins.dict)
| Counter(iterable=None, /, **kwds)
|
| Dict subclass for counting hashable items. Sometimes called a bag
| or multiset. Elements are stored as dictionary keys and their counts
| are stored as dictionary values.
|
| >>> c = Counter('abcdeabcdabcaba') # count elements from a string
|
| >>> c.most_common(3) # three most common elements
| [('a', 5), ('b', 4), ('c', 3)]
| >>> sorted(c) # list all unique elements
| ['a', 'b', 'c', 'd', 'e']
| >>> ''.join(sorted(c.elements())) # list elements with repetitions
| 'aaaaabbbbcccdde'
| >>> sum(c.values()) # total of all counts
| 15
|
| >>> c['a'] # count of letter 'a'
| 5
| >>> for elem in 'shazam': # update counts from an iterable
| ... c[elem] += 1 # by adding 1 to each element's count
| >>> c['a'] # now there are seven 'a'
| 7
| >>> del c['b'] # remove all 'b'
| >>> c['b'] # now there are zero 'b'
| 0
|
| >>> d = Counter('simsalabim') # make another counter
| >>> c.update(d) # add in the second counter
| >>> c['a'] # now there are nine 'a'
| 9
|
| >>> c.clear() # empty the counter
| >>> c
| Counter()
|
| Note: If a count is set to zero or reduced to zero, it will remain
| in the counter until the entry is deleted or the counter is cleared:
|
| >>> c = Counter('aaabbc')
| >>> c['b'] -= 2 # reduce the count of 'b' by two
| >>> c.most_common() # 'b' is still in, but its count is zero
| [('a', 3), ('c', 1), ('b', 0)]
|
| Method resolution order:
| Counter
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __add__(self, other)
| Add counts from two counters.
|
| >>> Counter('abbb') + Counter('bcc')
| Counter({'b': 4, 'c': 2, 'a': 1})
|
| __and__(self, other)
| Intersection is the minimum of corresponding counts.
|
| >>> Counter('abbb') & Counter('bcc')
| Counter({'b': 1})
|
| __delitem__(self, elem)
| Like dict.__delitem__() but does not raise KeyError for missing values.
|
| __eq__(self, other)
| True if all counts agree. Missing counts are treated as zero.
|
| __ge__(self, other)
| True if all counts in self are a superset of those in other.
|
| __gt__(self, other)
| True if all counts in self are a proper superset of those in other.
|
| __iadd__(self, other)
| Inplace add from another counter, keeping only positive counts.
|
| >>> c = Counter('abbb')
| >>> c += Counter('bcc')
| >>> c
| Counter({'b': 4, 'c': 2, 'a': 1})
|
| __iand__(self, other)
| Inplace intersection is the minimum of corresponding counts.
|
| >>> c = Counter('abbb')
| >>> c &= Counter('bcc')
| >>> c
| Counter({'b': 1})
|
| __init__(self, iterable=None, /, **kwds)
| Create a new, empty Counter object. And if given, count elements
| from an input iterable. Or, initialize the count from another mapping
| of elements to their counts.
|
| >>> c = Counter() # a new, empty counter
| >>> c = Counter('gallahad') # a new counter from an iterable
| >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
| >>> c = Counter(a=4, b=2) # a new counter from keyword args
|
| __ior__(self, other)
| Inplace union is the maximum of value from either counter.
|
| >>> c = Counter('abbb')
| >>> c |= Counter('bcc')
| >>> c
| Counter({'b': 3, 'c': 2, 'a': 1})
|
| __isub__(self, other)
| Inplace subtract counter, but keep only results with positive counts.
|
| >>> c = Counter('abbbc')
| >>> c -= Counter('bccd')
| >>> c
| Counter({'b': 2, 'a': 1})
|
| __le__(self, other)
| True if all counts in self are a subset of those in other.
|
| __lt__(self, other)
| True if all counts in self are a proper subset of those in other.
|
| __missing__(self, key)
| The count of elements not in the Counter is zero.
|
| __ne__(self, other)
| True if any counts disagree. Missing counts are treated as zero.
|
| __neg__(self)
| Subtracts from an empty counter. Strips positive and zero counts,
| and flips the sign on negative counts.
|
| __or__(self, other)
| Union is the maximum of value in either of the input counters.
|
| >>> Counter('abbb') | Counter('bcc')
| Counter({'b': 3, 'c': 2, 'a': 1})
|
| __pos__(self)
| Adds an empty counter, effectively stripping negative and zero counts
|
| __reduce__(self)
| Helper for pickle.
|
| __repr__(self)
| Return repr(self).
|
| __sub__(self, other)
| Subtract count, but keep only results with positive counts.
|
| >>> Counter('abbbc') - Counter('bccd')
| Counter({'b': 2, 'a': 1})
|
| copy(self)
| Return a shallow copy.
|
| elements(self)
| Iterator over elements repeating each as many times as its count.
|
| >>> c = Counter('ABCABC')
| >>> sorted(c.elements())
| ['A', 'A', 'B', 'B', 'C', 'C']
|
| Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
|
| >>> import math
| >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
| >>> math.prod(prime_factors.elements())
| 1836
|
| Note, if an element's count has been set to zero or is a negative
| number, elements() will ignore it.
|
| most_common(self, n=None)
| List the n most common elements and their counts from the most
| common to the least. If n is None, then list all element counts.
|
| >>> Counter('abracadabra').most_common(3)
| [('a', 5), ('b', 2), ('r', 2)]
|
| subtract(self, iterable=None, /, **kwds)
| Like dict.update() but subtracts counts instead of replacing them.
| Counts can be reduced below zero. Both the inputs and outputs are
| allowed to contain zero and negative counts.
|
| Source can be an iterable, a dictionary, or another Counter instance.
|
| >>> c = Counter('which')
| >>> c.subtract('witch') # subtract elements from another iterable
| >>> c.subtract(Counter('watch')) # subtract elements from another counter
| >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch
| 0
| >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch
| -1
|
| total(self)
| Sum of the counts
|
| update(self, iterable=None, /, **kwds)
| Like dict.update() but add counts instead of replacing them.
|
| Source can be an iterable, a dictionary, or another Counter instance.
|
| >>> c = Counter('which')
| >>> c.update('witch') # add elements from another iterable
| >>> d = Counter('watch')
| >>> c.update(d) # add elements from another counter
| >>> c['h'] # four 'h' in which, witch, and watch
| 4
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, v=None)
| Create a new dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __iter__(self, /)
| Implement iter(self).
|
| __len__(self, /)
| Return len(self).
|
| __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.
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| 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.
|
| values(...)
| D.values() -> an object providing a view on D's values
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| 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.
class OrderedDict(builtins.dict)
| Dictionary that remembers insertion order
|
| Method resolution order:
| OrderedDict
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __delitem__(self, key, /)
| Delete self[key].
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __gt__(self, value, /)
| Return self>value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, value, /)
| Return self|=value.
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __or__(self, value, /)
| Return self|value.
|
| __reduce__(...)
| Return state information for pickling
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
| od.__reversed__() <==> reversed(od)
|
| __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(...)
| od.clear() -> None. Remove all items from od.
|
| copy(...)
| od.copy() -> a shallow copy of od
|
| 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
|
| move_to_end(self, /, key, last=True)
| Move an existing element to the end (or beginning if last is false).
|
| Raise KeyError if the element does not exist.
|
| pop(...)
| od.pop(key[,default]) -> 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, /, last=True)
| Remove and return a (key, value) pair from the dictionary.
|
| Pairs are returned in LIFO order if last is true or FIFO order if false.
|
| 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 defined here:
|
| fromkeys(iterable, value=None)
| Create a new ordered dictionary with keys from iterable and values set to value.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.dict:
|
| __contains__(self, key, /)
| True if the dictionary has the specified key, else False.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __len__(self, /)
| Return len(self).
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.dict:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| 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.
class UserDict(collections.abc.MutableMapping)
| UserDict(dict=None, /, **kwargs)
|
| Method resolution order:
| UserDict
| 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, key)
| # Modify __contains__ and get() to work like dict
| # does when __missing__ is present.
|
| __copy__(self)
|
| __delitem__(self, key)
|
| __getitem__(self, key)
|
| __init__(self, dict=None, /, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __ior__(self, other)
|
| __iter__(self)
|
| __len__(self)
|
| __or__(self, other)
| Return self|value.
|
| __repr__(self)
| Return repr(self).
|
| __ror__(self, other)
| Return value|self.
|
| __setitem__(self, key, item)
|
| copy(self)
|
| get(self, key, default=None)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromkeys(iterable, value=None)
|
| ----------------------------------------------------------------------
| 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()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.MutableMapping:
|
| clear(self)
| D.clear() -> None. Remove all items from D.
|
| pop(self, key, default=<object object at 0x000001D727B381F0>)
| 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:
|
| __eq__(self, other)
| Return self==value.
|
| 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:
|
| __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,).
class UserList(collections.abc.MutableSequence)
| UserList(initlist=None)
|
| A more or less complete user-defined wrapper around list objects.
|
| Method resolution order:
| UserList
| collections.abc.MutableSequence
| collections.abc.Sequence
| collections.abc.Reversible
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __add__(self, other)
|
| __contains__(self, item)
|
| __copy__(self)
|
| __delitem__(self, i)
|
| __eq__(self, other)
| Return self==value.
|
| __ge__(self, other)
| Return self>=value.
|
| __getitem__(self, i)
|
| __gt__(self, other)
| Return self>value.
|
| __iadd__(self, other)
|
| __imul__(self, n)
|
| __init__(self, initlist=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __le__(self, other)
| Return self<=value.
|
| __len__(self)
|
| __lt__(self, other)
| Return self<value.
|
| __mul__(self, n)
|
| __radd__(self, other)
|
| __repr__(self)
| Return repr(self).
|
| __rmul__ = __mul__(self, n)
|
| __setitem__(self, i, item)
|
| append(self, item)
| S.append(value) -- append value to the end of the sequence
|
| clear(self)
| S.clear() -> None -- remove all items from S
|
| copy(self)
|
| count(self, item)
| S.count(value) -> integer -- return number of occurrences of value
|
| extend(self, other)
| S.extend(iterable) -- extend sequence by appending elements from the iterable
|
| index(self, item, *args)
| S.index(value, [start, [stop]]) -> integer -- return first index of value.
| Raises ValueError if the value is not present.
|
| Supporting start and stop arguments is optional, but
| recommended.
|
| insert(self, i, item)
| S.insert(index, value) -- insert value before index
|
| pop(self, i=-1)
| S.pop([index]) -> item -- remove and return item at index (default last).
| Raise IndexError if list is empty or index is out of range.
|
| remove(self, item)
| S.remove(value) -- remove first occurrence of value.
| Raise ValueError if the value is not present.
|
| reverse(self)
| S.reverse() -- reverse *IN PLACE*
|
| sort(self, /, *args, **kwds)
|
| ----------------------------------------------------------------------
| 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()
|
| __hash__ = None
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Sequence:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Reversible:
|
| __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 UserString(collections.abc.Sequence)
| UserString(seq)
|
| Method resolution order:
| UserString
| collections.abc.Sequence
| collections.abc.Reversible
| collections.abc.Collection
| collections.abc.Sized
| collections.abc.Iterable
| collections.abc.Container
| builtins.object
|
| Methods defined here:
|
| __add__(self, other)
|
| __complex__(self)
|
| __contains__(self, char)
|
| __eq__(self, string)
| Return self==value.
|
| __float__(self)
|
| __ge__(self, string)
| Return self>=value.
|
| __getitem__(self, index)
|
| __getnewargs__(self)
|
| __gt__(self, string)
| Return self>value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, seq)
| Initialize self. See help(type(self)) for accurate signature.
|
| __int__(self)
|
| __le__(self, string)
| Return self<=value.
|
| __len__(self)
|
| __lt__(self, string)
| Return self<value.
|
| __mod__(self, args)
|
| __mul__(self, n)
|
| __radd__(self, other)
|
| __repr__(self)
| Return repr(self).
|
| __rmod__(self, template)
|
| __rmul__ = __mul__(self, n)
|
| __str__(self)
| Return str(self).
|
| capitalize(self)
| # the following methods are defined in alphabetical order:
|
| casefold(self)
|
| center(self, width, *args)
|
| count(self, sub, start=0, end=9223372036854775807)
| S.count(value) -> integer -- return number of occurrences of value
|
| encode(self, encoding='utf-8', errors='strict')
|
| endswith(self, suffix, start=0, end=9223372036854775807)
|
| expandtabs(self, tabsize=8)
|
| find(self, sub, start=0, end=9223372036854775807)
|
| format(self, /, *args, **kwds)
|
| format_map(self, mapping)
|
| index(self, sub, start=0, end=9223372036854775807)
| S.index(value, [start, [stop]]) -> integer -- return first index of value.
| Raises ValueError if the value is not present.
|
| Supporting start and stop arguments is optional, but
| recommended.
|
| isalnum(self)
|
| isalpha(self)
|
| isascii(self)
|
| isdecimal(self)
|
| isdigit(self)
|
| isidentifier(self)
|
| islower(self)
|
| isnumeric(self)
|
| isprintable(self)
|
| isspace(self)
|
| istitle(self)
|
| isupper(self)
|
| join(self, seq)
|
| ljust(self, width, *args)
|
| lower(self)
|
| lstrip(self, chars=None)
|
| partition(self, sep)
|
| removeprefix(self, prefix, /)
|
| removesuffix(self, suffix, /)
|
| replace(self, old, new, maxsplit=-1)
|
| rfind(self, sub, start=0, end=9223372036854775807)
|
| rindex(self, sub, start=0, end=9223372036854775807)
|
| rjust(self, width, *args)
|
| rpartition(self, sep)
|
| rsplit(self, sep=None, maxsplit=-1)
|
| rstrip(self, chars=None)
|
| split(self, sep=None, maxsplit=-1)
|
| splitlines(self, keepends=False)
|
| startswith(self, prefix, start=0, end=9223372036854775807)
|
| strip(self, chars=None)
|
| swapcase(self)
|
| title(self)
|
| translate(self, *args)
|
| upper(self)
|
| zfill(self, width)
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| maketrans(...)
| Return a translation table usable for str.translate().
|
| If there is only one argument, it must be a dictionary mapping Unicode
| ordinals (integers) or characters to Unicode ordinals, strings or None.
| Character keys will be then converted to ordinals.
| If there are two arguments, they must be strings of equal length, and
| in the resulting dictionary, each character in x will be mapped to the
| character at the same position in y. If there is a third argument, it
| must be a string, whose characters will be mapped to None in the result.
|
| ----------------------------------------------------------------------
| 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()
|
| ----------------------------------------------------------------------
| Methods inherited from collections.abc.Sequence:
|
| __iter__(self)
|
| __reversed__(self)
|
| ----------------------------------------------------------------------
| Class methods inherited from collections.abc.Reversible:
|
| __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 defaultdict(builtins.dict)
| defaultdict(default_factory=None, /, [...]) --> dict with default factory
|
| The default factory is called without arguments to produce
| a new value when a key is not present, in __getitem__ only.
| A defaultdict compares equal to a dict with the same items.
| All remaining arguments are treated the same as if they were
| passed to the dict constructor, including keyword arguments.
|
| Method resolution order:
| defaultdict
| builtins.dict
| builtins.object
|
| Methods defined here:
|
| __copy__(...)
| D.copy() -> a shallow copy of D.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __missing__(...)
| __missing__(key) # Called by __getitem__ for missing key; pseudo-code:
| if self.default_factory is None: raise KeyError((key,))
| self[key] = value = self.default_factory()
| return value
|
| __or__(self, value, /)
| Return self|value.
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| __ror__(self, value, /)
| Return value|self.
|
| copy(...)
| D.copy() -> a shallow copy of D.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| default_factory
| Factory for default value called by __missing__().
|
| ----------------------------------------------------------------------
| 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.
|
| __getitem__(self, key, /)
| Return self[key].
|
| __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.
|
| __reversed__(self, /)
| Return a reverse iterator over the dict keys.
|
| __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.
|
| get(self, key, default=None, /)
| Return the value for key if key is in the dictionary, else default.
|
| 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:
|
| 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
class deque(builtins.object)
| deque([iterable[, maxlen]]) --> deque object
|
| A list-like sequence optimized for data accesses near its endpoints.
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __copy__(...)
| Return a shallow copy of a deque.
|
| __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).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __iadd__(self, value, /)
| Implement self+=value.
|
| __imul__(self, value, /)
| Implement self*=value.
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| __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.
|
| __reduce__(...)
| Return state information for pickling.
|
| __repr__(self, /)
| Return repr(self).
|
| __reversed__(...)
| D.__reversed__() -- return a reverse iterator over the deque
|
| __rmul__(self, value, /)
| Return value*self.
|
| __setitem__(self, key, value, /)
| Set self[key] to value.
|
| __sizeof__(...)
| D.__sizeof__() -- size of D in memory, in bytes
|
| append(...)
| Add an element to the right side of the deque.
|
| appendleft(...)
| Add an element to the left side of the deque.
|
| clear(...)
| Remove all elements from the deque.
|
| copy(...)
| Return a shallow copy of a deque.
|
| count(...)
| D.count(value) -- return number of occurrences of value
|
| extend(...)
| Extend the right side of the deque with elements from the iterable
|
| extendleft(...)
| Extend the left side of the deque with elements from the iterable
|
| index(...)
| D.index(value, [start, [stop]]) -- return first index of value.
| Raises ValueError if the value is not present.
|
| insert(...)
| D.insert(index, object) -- insert object before index
|
| pop(...)
| Remove and return the rightmost element.
|
| popleft(...)
| Remove and return the leftmost element.
|
| remove(...)
| D.remove(value) -- remove first occurrence of value.
|
| reverse(...)
| D.reverse() -- reverse *IN PLACE*
|
| rotate(...)
| Rotate the deque n steps to the right (default n=1). If n is negative, rotates left.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| __class_getitem__(...)
| See PEP 585
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| maxlen
| maximum size of a deque or None if unbounded
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
FUNCTIONS
namedtuple(typename, field_names, *, rename=False, defaults=None, module=None)
Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) # instantiate with positional args or keywords
>>> p[0] + p[1] # indexable like a plain tuple
33
>>> x, y = p # unpack like a regular tuple
>>> x, y
(11, 22)
>>> p.x + p.y # fields also accessible by name
33
>>> d = p._asdict() # convert to a dictionary
>>> d['x']
11
>>> Point(**d) # convert from a dictionary
Point(x=11, y=22)
>>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
Point(x=100, y=22)
DATA
__all__ = ['ChainMap', 'Counter', 'OrderedDict', 'UserDict', 'UserList...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\collections\__init__.py
urllib.robotparser.urllib
Python Library Documentation: package urllib
NAME
urllib
MODULE REFERENCE
https://docs.python.org/3.12/library/urllib.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.
PACKAGE CONTENTS
error
parse
request
response
robotparser
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\urllib\__init__.py