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