3
def verify_proxy(proxy_type, proxy):
5
This verifies a proxy string. It works by whitelisting
6
certain charackters: 0-9a-zA-Z:/?=-;~+
8
# protocol://host:port/stuff
9
verify_str = "%s://[a-zA-Z0-9.-]+:[0-9]+/*$" % proxy_type
11
if not re.match(verify_str, proxy):
15
def verify_no_proxy(proxy):
17
This verifies a proxy string. It works by whitelisting
18
certain charackters: 0-9a-zA-Z:/?=-;~+
20
# protocol://host:port/stuff
21
verify_str = "[a-zA-Z0-9.-:,]+"
23
if not re.match(verify_str, proxy):