File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,22 @@ def fetch_ip(ip_address):
5151
5252def check_alive (ip_address ):
5353 try :
54- result = requests .get ("http://ipecho.net/plain" , proxies = {'http' : "http://" + ip_address + ":8899" }, timeout = 10 )
54+ if settings .config ["no_auth" ]:
55+ proxies = {
56+ "http" : "http://" + ip_address + ":8899" ,
57+ "https" : "http://" + ip_address + ":8899" ,
58+ }
59+ else :
60+ auth = (
61+ settings .config ["auth" ]["username" ] + ":" + settings .config ["auth" ]["password" ]
62+ )
63+
64+ proxies = {
65+ "http" : "http://" + auth + "@" + ip_address + ":8899" ,
66+ "https" : "http://" + auth + "@" + ip_address + ":8899" ,
67+ }
68+
69+ result = requests .get ("http://ipecho.net/plain" , proxies = proxies , timeout = 10 )
5570 if result .status_code in (200 , 407 ):
5671 return True
5772 else :
You can’t perform that action at this time.
0 commit comments