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.3.tar.gz (98.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.3-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bazooka-1.3.3.tar.gz
  • Upload date:
  • Size: 98.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.3.tar.gz
Algorithm Hash digest
SHA256 ef8369dc34ae4a519ac467530eedb3e4d4c752fbed6092117f5af4daec891de2
MD5 ce9fd09fde8c6d9807975d66bb503913
BLAKE2b-256 e436193adf007c4eb8d02c64282c66aa9bbb3feece6cbd25f06275cdb4e36850

See more details on using hashes here.

Provenance

The following attestation bundles were made for bazooka-1.3.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: bazooka-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 25.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 147c0143e89953dcc08e653c1cf21a4606b6b62117420f4d98a190fe4fd84510
MD5 ffc024711285a489c31c18fb1ef32f22
BLAKE2b-256 2738cd757148f9d507343576290bb720decdd0f8b692f2020e3bcc4c7de63f4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bazooka-1.3.3-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