apywrapper
Easy development of RESTful API wrapper
Feature
- Get response as dataclass object you defined
- Return type can be specified by type annotation of api function
- All parameters (query, path variable, or json data) can be specified at once
install
pip install apywrapper
Example
from apywrapper import Apy, delete, get, patch, post, put
from typing import List, no_type_check
from dataclasses import dataclass
@dataclass
class User:
name: str
id: str
@no_type_check
class ApiClient(Apy):
def __init__(self, token, host="https://example.com/api":
super().__init__(host, headers={"api-token": token})
@get("/users/")
def get_users(self) -> List[User]:
return {}
@get("/users/{user_id}")
def get_user(self, user_id) -> User:
return {"user_id": user_id}
api = ApiClient(token="xxxxxxxxxxxxxxxxxx")
sh1ma = api.get_user("sh1ma") # return User object
Release files for apywrapper 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apywrapper-0.1.12.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apywrapper-0.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / apywrapper-0.1.12.tar.gz
| Download URL | apywrapper-0.1.12.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfb8a112d6b5de8a993bb4bd23e0348f71221ac82c24f5c3de880ebbb938ec5d
|
|
BLAKE2b-256 checksum How to use checksums |
dae03b5d8aa98c7fa4d1c182eb8e99adfca335130f650f27733279c96a4473c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-1025-azure
|
Release files / apywrapper-0.1.12-py3-none-any.whl
| Download URL | apywrapper-0.1.12-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d1d60d6d34e73dddcb87779dc136cf1df387940db9c6961543c1a1d9a11b65c
|
|
BLAKE2b-256 checksum How to use checksums |
e8cc0e09052d9a44747290c38dda1363bb326fc5dfb41f93346bb96e88686464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.8.5 Linux/5.4.0-1025-azure
|