-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Hello,
Thanks for the great library!
I just ran into a mypy error for the following code.
def fun(proxies: httpx.Proxy | None) -> None:
with httpx.Client(proxies=proxies):
passerror: Argument "proxies" to "Client" has incompatible type "Optional[Proxy]"; expected "Union[Union[URL, str], Proxy, Dict[Union[URL, str], Union[None, Union[URL, str], Proxy]]]" [arg-type]
Found 1 error in 1 file (checked 1 source file)
I find this surprising because the httpx.Client constructor parameter proxies is advertised as optional:
- proxies - (optional) A dictionary mapping proxy keys to proxy
URLs.
https://github.com/encode/httpx/blob/master/httpx/_client.py#L598-L599
It's also the default value for the parameter:
proxies: ProxiesTypes = None,https://github.com/encode/httpx/blob/master/httpx/_client.py#L626
Should the type be changed to typing.Optional[ProxiesTypes] or am I missing something?
I could not find any existing issue related to this but if I somehow miss it feel free to point me to it and close this one 😇
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested