proxies argument option: handles bytes literals in dict differently from other argument options
https_proxy = b'http://localhost:8080'
http_proxy = b'http://localhost:8080'
proxy_dict = {b'https' : https_proxy, b'http' : http_proxy}
r = requests.request(url, proxies=proxy_dict, verify=False)
Expected Result
The proxies argument option accepts bytes literals as arguments, and proxies are being used.
Actual Result
The proxies argument option accepts bytes literals as arguments, but seems to disregard them internally: Proxies have no effect. However, no exception is raised either.
Problem
The proxies argument option handles bytes literals differently compared to the other argument options, e.g.. parameters or data. The proxies argument option only works with str:
https_proxy = 'http://localhost:8080'
http_proxy = 'http://localhost:8080'
proxy_dict = {'https' : https_proxy, 'http' : http_proxy}
Exceptions are ignored. Using bytes literals does not raise an exception.
Going to check this out
I think we need to establish why byte literals should be accepted. I don't believe you can pass a bytes literal as a URL to requests.
This ended up getting answered but this issue wasn't closed. proxies arguments must be a str based dict for both keys and values. URLs that are bytes have a number of undefined behaviors within the Requests codebase. We normalize all url input directly into Requests to strings and that's the assumption the internals of the library operate on.