pyramid_blacksmith¶
- class pyramid_blacksmith.PyramidBlacksmith(request: Request, clients: dict[str, SyncClientFactory[Any]], middleware_factories: dict[str, list[AbstractMiddlewareFactoryBuilder]])¶
Type of the request.blacksmith property.
This can be used to create a
Protocol
of the pyramidRequest
in final application for typing purpose.Example:
from pyramid_blacksmith import PyramidBlacksmith class RequestProtocol(Protocol): blacksmith: PyramidBlacksmith def my_view(request: RequestProtocol): ...
- __getattr__(name: str) Callable[[str], SyncClient[Any]] ¶
Return the blacksmith client factory named in the configuration.
- pyramid_blacksmith.includeme(config: Configurator)¶
Expose the method consume by the Configurator while using:
config.include('pyramid_blacksmith')
This will inject the request property
request.blacksmith
like the pyramid view below:def my_view(request): api = request.blacksmith.client("api") ...