Turning this readable code into Python 3

0

Hello, I wanted to know how to make this legible code for Python 3 '

import urllib

proxy = {'http': 'http://myproxy:port'}
print ("Using HTTP proxy %s" % proxy['http'])
urllib.urlopen('https://google.com', proxies=proxy).read()
f = urllib.urlopen('https://drrr.com', proxies=proxy).read()
print(f)
    
asked by anonymous 29.04.2018 / 01:30

1 answer

0

Here's an example of how to use urllib in Python 3 with the requirements you have:

from urllib.request import URLopener
proxy = {'http': 'http://myproxy:port'}
urlopener = URLopener(proxy)
content = urlopener.open('https://mywebsite.com').read()
print(content)
    
29.04.2018 / 02:03