Python DSL for Web API clients.
Also check lapidary-render, a command line program that generates Lapidary clients from OpenAPI.
class CatClient(ClientBase):
"""This class is a working API client"""
def __init__(self):
super().__init__(
base_url='https://example.com/api',
)
@get('/cat')
async def list_cats(self: Self) -> Annotated[
tuple[list[Cat], CatListMeta],
Responses({
'2XX': Response(
Body({
'application/json': list[Cat],
}),
CatListMeta
),
})
]:
pass
client = CatClient()
cats_body, cats_meta = await client.list_cats()