pyramid_blacksmith#
- class pyramid_blacksmith.PyramidBlacksmith(request: pyramid.request.Request, clients: Dict[str, blacksmith.service._sync.client.SyncClientFactory[Any]], middleware_factories: Dict[str, List[pyramid_blacksmith.middleware_factory.AbstractMiddlewareFactoryBuilder]])#
Type of the request.blacksmith property.
This can be used to create a
Protocolof the pyramidRequestin 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], blacksmith.service._sync.client.SyncClient[Any]]#
Return the blacksmith client factory named in the configuration.
- pyramid_blacksmith.includeme(config: pyramid.config.Configurator)#
Expose the method consume by the Configurator while using:
config.include('pyramid_blacksmith')
This will inject the request property
request.blacksmithlike the pyramid view below:def my_view(request): api = request.blacksmith.client("api") ...