Foundation for building API clients. A wrapper around requests.
Project description
baseclient
Foundation for building API clients. A wrapper around requests which is licensed under the Apache License 2.0. See the LICENSE file for more details. The original NOTICE file is included in this project and extended with this project's notice.
import requests
from realerikrani.baseclient import BaseAdapter, BaseClient
adapter = BaseAdapter()
with requests.Session() as session:
baseclient = BaseClient(session=session, adapter=adapter, url=YOUR_BASE_URL)
return YourCustomClient(baseclient)
@dataclass
class YourCustomClient:
http_client: BaseClient
def create(self: Self, name: str) -> YourModel:
url = f"{self.http_client.url}/things"
response = self.http_client.post(
url, data={"name": name}, auth=None
).json()
return YourModel.make(response["thing"])
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
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 realerikrani_baseclient-1.0.0.tar.gz.
File metadata
- Download URL: realerikrani_baseclient-1.0.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8358aac59f509b38221a2145d2f8a2eb586ada2de0e178727ecbc9713db3b71a
|
|
| MD5 |
88d7940624e54718a7591cf814429974
|
|
| BLAKE2b-256 |
b6e4a0b9f548655becff1e4a07fc9a3ef96ace4bd5bf23f873b74292abc034b0
|
File details
Details for the file realerikrani_baseclient-1.0.0-py3-none-any.whl.
File metadata
- Download URL: realerikrani_baseclient-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5ccbd721ba69d1e1a4dbdc3c26355d4b6c4ea88b8a4156ac0fadb7d3fab1496
|
|
| MD5 |
a3995309b8adf6a9a327f71881325869
|
|
| BLAKE2b-256 |
79b29300543147fdbe54582b4f92fe4c3ecc3c1830be306dcb628987f40a124e
|