cast to string in __repr__

This commit is contained in:
Roy Olav Purser 2021-05-13 08:31:50 +02:00
parent e94f169303
commit 77d0de7ef0
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -27,7 +27,7 @@ class ProxyElem():
self.req["http"] = "socks5://" + proxy self.req["http"] = "socks5://" + proxy
self.req["https"] = "socks5://" + proxy self.req["https"] = "socks5://" + proxy
def __repr__(self): def __repr__(self):
return self.proxy return str(self.proxy)
proxies = {} proxies = {}
for key in providers: for key in providers:
@ -188,10 +188,11 @@ class MainHandler(tornado.web.RequestHandler):
current_list = proxy_list.copy() current_list = proxy_list.copy()
current = proxy_list.pop() current = proxy_list.pop()
proxy_list = [current] + proxy_list proxy_list = [current] + proxy_list
print(current) print(proxy_list)
try: try:
resp = requests.head(src, allow_redirects=True, proxies=current.req, timeout=2) resp = requests.head(src, allow_redirects=True, proxies=current.req, timeout=2)
if resp is not None: if resp is not None:
print(src)
src = resp.url src = resp.url
except Exception as e: except Exception as e:
print(e) print(e)