Asas¶
Asas framework, high performance, easy to learn, fast to code, ready for production
About¶
Asas is a streamlined framework for building API clients (SDKs) through a clean,
decorator-based interface. You subclass a client, annotate methods with @get / @post /
etc., and Asas handles request building, authentication, parsing, and retries for you.
It is engineered for modern Python: native async/await support and first-class
Pydantic integration for request and response validation.
Goal¶
The core objective of Asas is to make API integration more Pythonic, elegant, and maintainable. By abstracting the verbosity of traditional request libraries, Asas lets you focus on clear architecture and expressive code.
Installation¶
Quick start¶
Asas ships separate clients for synchronous and asynchronous code. The same decorators work
on both — Asas auto-detects async def methods.
from asas import AsasAsyncClient, get, Response
class MyAsyncClient(AsasAsyncClient):
@get("/users/{id}")
async def get_user(self, response: Response, id: int):
return response.json()
async def main():
client = MyAsyncClient(base_url="https://api.example.com")
user = await client.get_user(id=1)
await client.engine.aclose()
The injected first argument
The decorated method receives the parsed result as its first argument after self
(response above). Any remaining parameters — like id — are supplied by the caller
and routed into the request. See Routing & Parameters.
Feature highlights¶
- Clients — sync and async clients with a swappable transport and runtime-settable auth.
- Routing & Parameters —
@get/@post/@put/@delete/@patchwith automatic path, query, and body routing. - Request bodies & responses — Pydantic models in, validated
models out via
response_model. - Resources & pagination — convention-driven CRUD and lazy iteration over every record, with no page-loop code.
- Authentication — Basic, Bearer, API key, automatic refresh, and composite strategies.
- Engines & transports — a transport-agnostic core;
httpxis the bundled reference engine, with an optionalrequestsengine extra. - Core models — plain
Request/Response/Payloaddataclasses that every layer speaks.