psf / requests

A simple, yet elegant, HTTP library.
https://requests.readthedocs.io/en/latest/
Apache License 2.0
51.99k stars 9.29k forks source link

Proper TypeAnnotation for proxies #6514

Closed Cosmicoppai closed 1 year ago

Cosmicoppai commented 1 year ago

Feature Request: Proper Type Annotations for Proxies in Requests Library

Proposal

I propose enhancing the type annotations for proxy settings in the requests library to specify a dictionary of string keys and string values. This would provide clearer type expectations to users and improve the development experience when configuring proxies for HTTP requests. As it is not much needed, but it would be great if proper Annotations are present.

Currently, the type annotation for proxies in the requests class is defined as:

proxies: Any | None

Desired State

I suggest updating the type annotation for proxies to be more specific:

proxies: Optional[Dict[str, str]]
sigmavirus24 commented 1 year ago

There are no type annotations in this library. The error likely lies in typeshed if there's anything