Allows the 'auth' argument to be passed as a simple callable function, that takes the request, and returns a new, modified request.
| 111 | |
| 112 | |
| 113 | class 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 | |
| 126 | class BasicAuth(Auth): |