Skip to content

Instantly share code, notes, and snippets.

@danielchc
Created June 12, 2018 19:24
Show Gist options
  • Save danielchc/ba8ecea87412d1b892965a1081032158 to your computer and use it in GitHub Desktop.
Save danielchc/ba8ecea87412d1b892965a1081032158 to your computer and use it in GitHub Desktop.
Test proxy
from urllib import request as urlrequest
proxy_host = 'ip:port'
url = 'http://www.httpbin.org/ip'
#If returns 2 IP means that X-Forwarded isn't disabled
req = urlrequest.Request(url)
req.set_proxy(proxy_host, 'http')
response = urlrequest.urlopen(req)
print(response.read().decode('utf8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment