Closed MtkN1 closed 3 months ago
Add a callable object to the HttpAuthenticationType type definition.
HttpAuthenticationType
A type checking error occurs when a callable object is given as the auth argument.
auth
This is allowed at runtime.
https://github.com/jawah/niquests/blob/d83ab6b98e317bbf82ea950a693fce1fc95936a3/src/niquests/models.py#L615-L647
Add a callable object to the
HttpAuthenticationType
type definition.A type checking error occurs when a callable object is given as the
auth
argument.Reproduction code
```python import niquests def pizza_auth(request: niquests.PreparedRequest) -> niquests.PreparedRequest: if request.headers: request.headers["X-Pizza"] = "Token" return request def test_callable_auth(): r = niquests.get("https://httpbin.org/get", auth=pizza_auth) print(r.json()["headers"]) if __name__ == "__main__": test_callable_auth() ```This is allowed at runtime.
https://github.com/jawah/niquests/blob/d83ab6b98e317bbf82ea950a693fce1fc95936a3/src/niquests/models.py#L615-L647