Skip to main content

Reliable HTTP client

Project description

Bazooka - reliable HTTP client

tests workflow

Overview

Bazooka is a reliable and efficient HTTP client for Python that provides features such as retries out of the box, full compatibility with the requests library, and customizable logging options.

Key Features

  • retries: Bazooka includes built-in retry logic to handle temporary network failures or 5XX server errors.
  • full compatibility: Bazooka is designed to work seamlessly with the requests library, allowing for easy integration into existing projects.
  • explicit automatic error handling: by default client raises exception if status code isn't 2xx.
  • curl-like customizable Logging: Bazooka offers flexible logging options, including duration logging and sensitive logging support.

Example Usage

Basic Example

import bazooka

client = bazooka.Client()
print(client.get('http://example.com').json())

Using Correlation IDs

(Usable to match bazooka requests with your business logic logs)

from bazooka import correlation

client = bazooka.Client(correlation_id='my_correlation_id')
print(client.get('http://example.com').json())

Raised Exceptions on 4xx Errors

import bazooka
from bazooka import exceptions

client = bazooka.Client()

try:
    response = client.get('http://example.com', timeout=10)
except exceptions.NotFoundError:
    # process 404 error
    pass
except exceptions.ConflictError:
   # process 409 error
    pass
except exceptions.BaseHTTPException as e:
   # process other HTTP errors
    if e.code in range(400, 500):
        print(f"4xx Error: {e}")
    else:
        raise

Getting Started

To get started with Bazooka, install it via pip:

pip install bazooka

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

bazooka-1.3.4.tar.gz (99.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bazooka-1.3.4-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file bazooka-1.3.4.tar.gz.

File metadata

  • Download URL: bazooka-1.3.4.tar.gz
  • Upload date:
  • Size: 99.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bazooka-1.3.4.tar.gz
Algorithm Hash digest
SHA256 8c18087cfb74ee77f8e6cea1133f8fc46870b5d30f4b0142066b034d06a2efb0
MD5 8f01ec7fb784f5e312ea2bf46219c080
BLAKE2b-256 316f29b8a29f11b36686f796b6dcdb555499604dd9544c8581a93095d55345ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for bazooka-1.3.4.tar.gz:

Publisher: publish-to-pypi.yml on infraguys/bazooka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bazooka-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: bazooka-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bazooka-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3a11bcb32519a9d5728d6e24dd1afd0408ef5e6836c6a7aa95c06e4f73429e
MD5 d069a53a1dbd366c1b3e6f9bf56e8067
BLAKE2b-256 76b3ad4fd408f94d0faa2cd78b307bfc71790672edf1c5b511525afb748386f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bazooka-1.3.4-py3-none-any.whl:

Publisher: publish-to-pypi.yml on infraguys/bazooka

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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