Tiny API Client 🐝
Write JSON API Clients in Python without the fluff, pumped full of syntactic sugar
from tiny_api_client import api_client, get, post, delete
@api_client('https://example.org/api/public/v{version}')
class MyAPIClient:
@get('/users/{user_id}')
def find_user(self, response):
return response
@post('/notes')
def create_note(self, response):
return response
@delete('/notes/{note_id}/attachment/{attachment_id}', version=3)
def delete_note_attachment(self, response):
return response
>>> client = MyClient()
>>> client.find_user(user_id='PeterParker')
{'name': 'Peter', 'surname': 'Parker', ...}
>>> client.create_note(data={'title': 'New Note', 'content': 'Hello World!'})
{'id': ...}
>>> client.delete_note_attachment(node_id=...)
Features
- Instance-scoped
requests.Session()with connection pooling and cookie preservation - JSON is king, but XML and raw responses are fine too
- Endpoints can use GET, POST, PUT, PATCH, DELETE
- Route parameters are optional
- Easy integration with your custom API classes
- Declare endpoints under different API versions
- Can define the API URL at runtime if not available before
- Can set a custom CookieJar to pass with all requests
- Pass along any parameters you would usually pass to requests
- Custom JSON status error handling
- Installable pytest plugin for easy testing
- Excellent support for type checking thanks to a built-in mypy plugin
Installation
pip install tiny-api-client
Documentation
You can find the documentation at https://tiny-api-client.readthedocs.io
License
This software is distributed under the Lesser General Public License v2.1, more information available at the Free Software Foundation.
Metadata
Release files for tiny-api-client 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tiny_api_client-1.4.0.tar.gz | 64.6 kB | Without provenance | Details for tiny_api_client-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tiny_api_client-1.4.0-py3-none-any.whl | Python 3 | none | any | Details for tiny_api_client-1.4.0-py3-none-any.whl |
Total release size: 82.6 kB
Release files / tiny_api_client-1.4.0.tar.gz
| Download URL | tiny_api_client-1.4.0.tar.gz |
|---|---|
| Size | 64.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad6772b611dfc71535800d0db901258f8b0da6ac77e27a71260eaea507e69ed3
|
|
BLAKE2b-256 checksum How to use checksums |
6cc4b057e8018353448f3372432c2763b0e1f4978bfd6466c03bcae61981573e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / tiny_api_client-1.4.0-py3-none-any.whl
| Download URL | tiny_api_client-1.4.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e4af7ad4fcf549b850e46072b4ccd381a11acaef25ca09a61c6370a45bdd404
|
|
BLAKE2b-256 checksum How to use checksums |
32b60a47e06fd0d45b132a035fbc4ff24deb59d93f657e9de37ef591da06187c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for tiny-api-client 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.