Skip to main content

Democritus functions for working with network requests.

Project description

Democritus Networking

PyPI CI Lint codecov The Democritus Project uses semver version 2.0.0 The Democritus Project uses black to format code License: LGPL v3

Democritus functions[1] for working with network requests.

[1] Democritus functions are simple, effective, modular, well-tested, and well-documented Python functions.

We use d8s as an abbreviation for democritus (you can read more about this here).

Functions

  • def requests_basic_auth(user, password):
        """Return an instance of request's basic auth."""
    
  • def get(
        url,
        *,
        use_common_user_agent: bool = True,
        process_response: bool = False,
        process_response_as_bytes: bool = False,
        **request_kwargs,
    ):
        """Make a GET request to the given URL."""
    
  • def head(url, *, process_response: bool = False, **kwargs):
        """Make a head request."""
    
  • def post(
        url,
        *,
        update_headers_for_datatype: bool = True,
        process_response: bool = False,
        process_response_as_bytes: bool = False,
        **request_kwargs,
    ):
        """Make a POST request to the given URL with the given data."""
    
  • def headers_update(headers: Dict[str, str], new_header_key: str, new_header_value: Any, *, overwrite: bool = True):
        """."""
    
  • def put(
        url,
        *,
        update_headers_for_datatype: bool = True,
        process_response: bool = False,
        process_response_as_bytes: bool = False,
        **request_kwargs,
    ):
        """Make a PUT request to the given URL with the given data."""
    
  • def delete(
        url,
        *,
        process_response: bool = False,
        process_response_as_bytes: bool = False,
        **request_kwargs,
    ):
        """Make a DELETE request to the given URL with the given data."""
    
  • def url_hash(url, hash_type='sha256'):
        """Return the hash of the url."""
    
  • def urllib3_backoff_factor_executions(backoff_factor: float, number_of_requests: int):
        """Return the times (in seconds) of the first n requests with the given backoff_factor. See https://urllib3.readthedocs.io/en/latest/reference/index.html#urllib3.Retry under the "backoff_factor" argument."""
    

Development

👋  If you want to get involved in this project, we have some short, helpful guides below:

If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.

Credits

This package was created with Cookiecutter and Floyd Hightower's Python project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

d8s_networking-0.4.2.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

d8s_networking-0.4.2-py2.py3-none-any.whl (21.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file d8s_networking-0.4.2.tar.gz.

File metadata

  • Download URL: d8s_networking-0.4.2.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_networking-0.4.2.tar.gz
Algorithm Hash digest
SHA256 1f5a27cd6cd7f9e6368c4daa2b54e2fb65b794c185ebec555d75468fa2398d3f
MD5 5f9797a435a680d690584f5750b40fea
BLAKE2b-256 f25c5fbe2dfab854274b306ab3d15963b26c91b7006bd4ca4239ae4f78e1803a

See more details on using hashes here.

File details

Details for the file d8s_networking-0.4.2-py2.py3-none-any.whl.

File metadata

  • Download URL: d8s_networking-0.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for d8s_networking-0.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b9639deaa053f2b76537a6a7ebc2d509a902fc08487f09e2abd6a2456631c6f
MD5 d46b1c45032e23eaa46a894b3cf9a264
BLAKE2b-256 9f9f0b8b2f5ba1439c3000bc656eeb124cc901297fbc9b84894d07cdcfa558da

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page