微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python3,tor 网络刮板堵塞了 Tor 电路

如何解决python3,tor 网络刮板堵塞了 Tor 电路

我编写了 pyton3 网络爬虫,但它阻塞了 Tor 连接。我收到类似的错误

[warn] Guard ohrelay (xxxxx) is failing a very large amount of circuits. Most likely this means the Tor network is overloaded,but it Could also mean an attack against you or potentially the guard itself. Success counts are 79/262. Use counts are 0/0. 256 circuits completed,0 were unusable,177 collapsed,and 255 timed out. For reference,your timeout cutoff is 60 seconds.

[notice] We'd like to launch a circuit to handle a connection,but we already have 32 general-purpose client circuits pending. Waiting until some finish. [84886 similar message(s) suppressed in last 600 seconds]

我提出请求:(我也使用 Therad,有 10 个并发作业)

socks5h = "socks5h://127.0.0.1:9050"
http_proxy  = socks5h
https_proxy = socks5h
ftp_proxy   = socks5h
torproxy = { 
              "http"  : http_proxy,"https" : https_proxy,"ftp"   : ftp_proxy
}
send_headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','Accept-Language':'en-US,en;q=0.5','Accept-Encoding':'gzip,deflate','Connection':'keep-alive','Upgrade-Insecure-Requests':'1','Cache-Control':'max-age=0'                
}    
ret = requests.get(url,proxies=torproxy,headers=send_headers,verify=False,timeout=(10,10))

也许我需要销毁 ret 对象,但如何销毁?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。