supply proxy ip from cli

master
Felix Pankratz 5 years ago
parent 7553b45a34
commit 4015b9b891

@ -5,9 +5,12 @@ from urllib import request
import sys import sys
target = "http://theresno.cloud/ip" target = "http://theresno.cloud/ip"
proxy_handler = request.ProxyHandler({'https': 'http://felixpankratz.de:80/', 'http': 'http://felixpankratz.de:80/' }) prx = sys.argv[1]
print("Using proxy " + prx + " ...")
proxy_handler = request.ProxyHandler({'https': 'http://' + prx + '/', 'http': 'http://' + prx + '/' })
opener = request.build_opener(proxy_handler) opener = request.build_opener(proxy_handler)
result = opener.open(target)
content = result.read().decode() content = result.read().decode()
print(content) print(content)

Loading…
Cancel
Save