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.2.tar.gz (97.8 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.2-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bazooka-1.3.2.tar.gz
Algorithm Hash digest
SHA256 de5755170507bdd116ab44eaed918d3600a1c74b89c7f4ec8d6590fb8cf0ec8b
MD5 7d22a82239f151cda273cb5bf7b7690f
BLAKE2b-256 6eeff036a1d162ceac2b54994c59812c87899b4ad109a4603396d1111068aa30

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for bazooka-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 113246f823e42714bee7d99db305fc499cad52cd8f5139cae351b4db86710f3c
MD5 c3a3333de27603500f774a38068e7f3b
BLAKE2b-256 3468fe21e952f50597296f4a54b77d3d74d908aa2b73f9223c452856c2e79087

See more details on using hashes here.

Provenance

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