Skip to main content
apywrapper

apywrapper

lint PyPI version

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)

Source distribution for apywrapper 0.1.12
File Size Uploaded
apywrapper-0.1.12.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apywrapper 0.1.12
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.12 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page