Reliable HTTP client
Project description
Bazooka - reliable HTTP client
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
requestslibrary, 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de5755170507bdd116ab44eaed918d3600a1c74b89c7f4ec8d6590fb8cf0ec8b
|
|
| MD5 |
7d22a82239f151cda273cb5bf7b7690f
|
|
| BLAKE2b-256 |
6eeff036a1d162ceac2b54994c59812c87899b4ad109a4603396d1111068aa30
|
Provenance
The following attestation bundles were made for bazooka-1.3.2.tar.gz:
Publisher:
publish-to-pypi.yml on infraguys/bazooka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bazooka-1.3.2.tar.gz -
Subject digest:
de5755170507bdd116ab44eaed918d3600a1c74b89c7f4ec8d6590fb8cf0ec8b - Sigstore transparency entry: 984989205
- Sigstore integration time:
-
Permalink:
infraguys/bazooka@39b1dec9f7472b03d67b3ce4118157f8fccafdf3 -
Branch / Tag:
refs/tags/1.3.2 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@39b1dec9f7472b03d67b3ce4118157f8fccafdf3 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
113246f823e42714bee7d99db305fc499cad52cd8f5139cae351b4db86710f3c
|
|
| MD5 |
c3a3333de27603500f774a38068e7f3b
|
|
| BLAKE2b-256 |
3468fe21e952f50597296f4a54b77d3d74d908aa2b73f9223c452856c2e79087
|
Provenance
The following attestation bundles were made for bazooka-1.3.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on infraguys/bazooka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bazooka-1.3.2-py3-none-any.whl -
Subject digest:
113246f823e42714bee7d99db305fc499cad52cd8f5139cae351b4db86710f3c - Sigstore transparency entry: 984989206
- Sigstore integration time:
-
Permalink:
infraguys/bazooka@39b1dec9f7472b03d67b3ce4118157f8fccafdf3 -
Branch / Tag:
refs/tags/1.3.2 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@39b1dec9f7472b03d67b3ce4118157f8fccafdf3 -
Trigger Event:
push
-
Statement type: