API-Forwarder: Simplify API calls by sharing a base URL.
Project description
API Forwarder
Simplify API calls by sharing a base URL
Features
- No need to repeat the same base API URL for every request.
- Specify a base URL once, then call API endpoints using relative paths.
- Pluggable HTTP backends (httpx or CloudScraper).
This library is designed to be imported and reused across projects, providing a consistent and clean way to interact with HTTP-based APIs.
Usage
from api_forwarder import Forwarder
async def get_api():
async with Forwarder("https://api.example.com") as fw:
response = await fw.get("/v1/status")
response.raise_for_status()
print(response.json())
Use Other Options
from api_forwarder import Forwarder
async def get_api():
async with Forwarder(
"https://api.example.com",
backend="cloudscraper",
timeout=5.0,
retries=3,
retry_delay=1.0,
) as fw:
response = await fw.get("/v1/status")
response.raise_for_status()
print(response.json())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
api_forwarder-2.0.1.tar.gz
(27.9 kB
view details)
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 api_forwarder-2.0.1.tar.gz.
File metadata
- Download URL: api_forwarder-2.0.1.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a30115a87dd987c1396704f32f66cb5c820b9eb98a608bd7c0655581d484c18
|
|
| MD5 |
45e29106fe3aa027985b9d5411997ecf
|
|
| BLAKE2b-256 |
3297db59a62ea144ff458506551fb32cad2c501e29f542f38219a62392ccea49
|
File details
Details for the file api_forwarder-2.0.1-py3-none-any.whl.
File metadata
- Download URL: api_forwarder-2.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2fa49cd3250eead86aa39088d70f4812011bdc5993fac9be3bd2cd3a68e2e18
|
|
| MD5 |
42c7676cf88101778459c380673a12a9
|
|
| BLAKE2b-256 |
612d4f6f6597152001fe714bb48ea0f516cac89b655d4b616729272442e3b7b8
|