socket.socket = socks.socksocket
url = 'http://ifconfig.me/ip'
request = urllib.request.Request(url)
request.add_header('Cache-Control', 'max-age=0')
response = urllib.request.urlopen(request)
print(response.read())
How to make HTTP request through a (tor) socks proxy using python?