MCPcopy
hub / github.com/encode/httpx / FunctionAuth

Class FunctionAuth

httpx/_auth.py:113–123  ·  view source on GitHub ↗

Allows the 'auth' argument to be passed as a simple callable function, that takes the request, and returns a new, modified request.

Source from the content-addressed store, hash-verified

111
112
113class FunctionAuth(Auth):
114 """
115 Allows the 'auth' argument to be passed as a simple callable function,
116 that takes the request, and returns a new, modified request.
117 """
118
119 def __init__(self, func: typing.Callable[[Request], Request]) -> None:
120 self._func = func
121
122 def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]:
123 yield self._func(request)
124
125
126class BasicAuth(Auth):

Callers 1

_build_authMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected