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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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