Create API wrappers/clients in minutes, enjoying both blocking and async interfaces from one codebase!
Project description
Introduction
If you've ever tried to make an API wrapper you probably know that the code written can only be used as sync or async, well, not anymore.
Features
- Lightweight: Extremely lightweight and minimal
- Easy to use: Implement features in no time with the
- Async and blocking: Provides both async and blocking calls
- Test without a server: Since the library internally uses httpx, it can be used to test itself using an
ASGI
orWSGI
application. - DRY: Don't repeat yourself, helps avoid code duplication and write reusable code
- Routing: An
APIRouter
class with simliar API toAPIClient
- Modular: Create reusable routers that can be added to any client, independant of each other
Example Usage
from apiclient import APIClient, endpoint, Post
class CodeExecClient(APIClient):
base_url = "https://pathtomysite.com/api/1.0" # Note the missing / suffix
@endpoint
def run(self, language:str, code:str):
# Do any processing with the data here!
# Also note the / prefix in the url
return Post("/execute", params={'lang':language, 'code':code})
# Using the API client
from httpx import Client
client = CodeExecClient(session=Client())
response = client.run("py", "print('hello world!')")
Documentation is under works
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
File details
Details for the file instant-api-client-0.1.1.tar.gz
.
File metadata
- Download URL: instant-api-client-0.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c230ef115a2f065a46c0f39b5b7a40689ea7f525897ca1d07cee6790874439bf |
|
MD5 | 19fbcc325cfe40ea46eb205147932da7 |
|
BLAKE2b-256 | 5643b8cf2c9b8c118db5de320a264e6a0b0b59b64d07b1399c8443fafc9e1c58 |
File details
Details for the file instant_api_client-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: instant_api_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b293e822511c52349900916b1473fbd152e4857b12448294437360aaf6537b1 |
|
MD5 | 3863e7bcfd2dcbcdf58bf6756d97d453 |
|
BLAKE2b-256 | 616c47a31ce5664b34dff02bb15a2e966d1dc71f6824be408061321680abb668 |