BaseClient
Bases: ABC
Base client class.
Inherit from this class to implement a client.
Source code in pulsefire/clients.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
Attributes
session
class-attribute
instance-attribute
Context manager client session.
default_headers
instance-attribute
Default params (ignores ...
), can be overwritten by invoke
.
default_params
instance-attribute
Default header params, can be overwritten by invoke
.
default_queries
instance-attribute
Default query params, can be overwritten by invoke
.
middlewares
instance-attribute
Pre and post processors during invoke
.
Functions
__init__
__init__(
*,
base_url: str,
default_params: dict[str, Any] = {},
default_headers: dict[str, str] = {},
default_queries: dict[str, str] = {},
middlewares: list[Middleware] = []
) -> None
Source code in pulsefire/clients.py
__repr__
__aenter__
async
Context manager, in-context invocations will reuse a single aiohttp.ClientSession
improving performance and memory footprint.
Raises:
Type | Description |
---|---|
RuntimeError
|
When entering an already entered client. |
Source code in pulsefire/clients.py
__aexit__
async
Source code in pulsefire/clients.py
invoke
async
Build an Invocation and send through the middlewares.
Params are automatically grabbed from the outer frame (ignores ...
).
The invoker client method is automatically grabbed from the outer frame
and passed to the instantiation of Invocation.