API¶
pico_httpx.client ¶
Declarative HTTP clients: @http_client classes with @get/@post/ @put/@delete/@patch stub methods.
The decorator generates the implementation: path placeholders bind to the method's parameters, a parameter named json becomes the request body, every other bound parameter becomes a query param (None values are dropped). Sync stubs use a shared httpx.Client; async stubs a shared httpx.AsyncClient. Both close on container shutdown.
http_client(_cls=None, *, base_url='', name='') ¶
Turn a class of request stubs into an injectable HTTP client component.
base_url is either given literally or resolved from config at first request: http.clients.<name>.base_url (name defaults to the class name).
Source code in src/pico_httpx/client.py
pico_httpx.config ¶
Settings for pico-httpx (prefix http, zero-config).
HttpSettings dataclass ¶
clients maps a client name to its settings, e.g. http.clients.users.base_url. A literal base_url on the decorator wins over config.