opennem.utils package
Submodules
opennem.utils.http module
HTTP module with custom timeout and retry adaptors
usage:
from opennem.utils.http import http http.get(url) etc.
- class opennem.utils.http.TimeoutHTTPAdapter(*args, **kwargs)
Bases:
HTTPAdapter
- send(request, **kwargs)
Sends PreparedRequest object. Returns Response object.
- Parameters
request – The
PreparedRequest
being sent.stream – (optional) Whether to stream the request content.
timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.
verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert – (optional) Any user-provided SSL certificate to be trusted.
proxies – (optional) The proxies dictionary to apply to the request.
- Return type
requests.Response
- opennem.utils.http.setup_http_cache() bool
Sets up requests session local cachine using requests-cache if enabled in settings
opennem.utils.version module
- class opennem.utils.version.VersionPart(value)
Bases:
Enum
An enumeration.
- MAJOR = 'major'
- MINOR = 'minor'
- PATCH = 'patch'
- opennem.utils.version.get_pkg_version() Optional[str]
- opennem.utils.version.get_project_meta() Optional[Dict]
- opennem.utils.version.get_version(version_part: Optional[VersionPart] = None) str