Skip to main content

patera-apiinterface

Declarative async HTTP clients for external APIs in Patera applications. Part of Patera, a modular async-first Python web framework.

Installation

pip install patera-apiinterface
# or, with uv
uv add "patera[apiinterface]"

Requires Python 3.13 or newer and patera>=0.121.

Usage

patera-apiinterface turns annotated methods into HTTP calls (with HTTPX):

from patera import HttpMethod
from patera.apiinterface import ApiInterface, AuthType, auth, headers, method, resource, service, timeout


@service("GITHUB_URL")                         # config key or literal URL
@auth(AuthType.BEARER, token="GITHUB_TOKEN")   # config key or literal value
@headers({"X-Client": "my-app"})
@timeout(10)
class GithubApi(ApiInterface):

    @method(HttpMethod.GET)
    @resource("/repos/<repo_id>")              # filled from the argument of the same name
    async def get_repo(self, repo_id: int) -> Repo: ...   # Pydantic return types are validated

    @method(HttpMethod.POST)
    @resource("/repos")
    async def create_repo(self, name: str, private: bool) -> dict: ...   # arguments become the JSON body

See the External APIs section of the Patera documentation for the full guide.

License

MIT. See LICENSE.

Metadata

Release files for patera-apiinterface 0.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patera-apiinterface 0.11.1
File Size Uploaded
patera_apiinterface-0.11.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for patera-apiinterface 0.11.1
File Interpreter ABI Platform
patera_apiinterface-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / patera_apiinterface-0.11.1.tar.gz

Download URL patera_apiinterface-0.11.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
61e38aff73d606a79ebdf4a66dac1050b79b0cf0d02d98bc980e130677d20e51
BLAKE2b-256 checksum
How to use checksums
7cef1936cc1bd6536573f501f1ebee3b8a4eb51070ac4bc3045122068c12df0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / patera_apiinterface-0.11.1-py3-none-any.whl

Download URL patera_apiinterface-0.11.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
765d29b4d424591c3f06aaee47a93103987ac89232845b4a4ece686cd5308682
BLAKE2b-256 checksum
How to use checksums
a7ffa329827e604468c8ec130b544315bb162c0b8d03515d7088286dbb34ffc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.11.1 This release

2 release files

0.11.0

2 release files

0.10.0

1 release file

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.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