Receive empty proxy list when use urllib

30 Views Asked by At

I 'm trying to use urlopen with proxies to navigate to the site. But when I print the list of proxies I receive the empty list:

import urllib.request
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='PDQ Application',
                          uri='http://proxy_ip:proxy_port',
                          user='some_user',
                          passwd='some_pwd')
opener = urllib.request.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib.request.install_opener(opener)
r = urllib.request.urlopen('https://example.com/')
urllib.request.getproxies()

output is {}

Can you explain why, the proxy really exists with user and password

0

There are 0 best solutions below