torpyorg / torpy

Pure python Tor client implementation
Apache License 2.0
410 stars 51 forks source link

HTTP Error 503: Directory busy, try again later #8

Closed ajbenz18 closed 4 years ago

ajbenz18 commented 4 years ago

I tried almost all of the examples, and I seem to get errors for all of them. Does the package not work anymore? I feel like its probably not necessary to show you the errors I'm getting for all of them, here's what happens when I try to run the first one through the console:

$ torpy_cli --url https://ifconfig.me --header "User-Agent" "curl/7.37.0" Downloading new consensus from dizum authority [ignored] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 78, in newfn return func(*args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 175, in renew if not self.verify(new_doc): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 200, in verify pubkey = self._get_pubkey(sign['identity'], sign['signing_key_digest']) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 207, in _get_pubkey key_certificate = provider.download_fp_sk(identity, signing_key_digest) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 80, in download_fp_sk return http_get('{}/{}-{}'.format(self.fp_sk_url, identity, keyid)) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 190, in http_get with opener.open(url, timeout=timeout) as response: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error return self._call_chain(args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 503: Directory busy, try again later Retry with another authority... Downloading new consensus from dizum authority [ignored] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 78, in newfn return func(args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 175, in renew if not self.verify(new_doc): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 200, in verify pubkey = self._get_pubkey(sign['identity'], sign['signing_key_digest']) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 207, in _get_pubkey key_certificate = provider.download_fp_sk(identity, signing_key_digest) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 80, in download_fp_sk return http_get('{}/{}-{}'.format(self.fp_sk_url, identity, keyid)) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 190, in http_get with opener.open(url, timeout=timeout) as response: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error return self._call_chain(args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 503: Directory busy, try again later Retry with another authority... Downloading new consensus from tor26 authority [ignored] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 938, in connect (self.host,self.port), self.timeout, self.source_address) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 728, in create_connection raise err File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 78, in newfn return func(*args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 163, in renew raw_string = authority.download('consensus', prev_hash=prev_hash) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 70, in download return http_get('{}/{}'.format(self.status_url, doc_type), headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 190, in http_get with opener.open(url, timeout=timeout) as response: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1347, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1321, in do_open raise URLError(err) urllib.error.URLError: Retry with another authority... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 938, in connect (self.host,self.port), self.timeout, self.source_address) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 728, in create_connection raise err File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/torpy_cli", line 11, in load_entry_point('torpy==1.0.10', 'console_scripts', 'torpy_cli')() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/cli/console.py", line 60, in main auth_data=args.auth_data, verbose=args.verbose) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/http/urlopener.py", line 125, in do_request with tor_opener(hops_count=hops, auth_data=auth_data, debuglevel=verbose) as opener: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in enter return next(self.gen) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/http/urlopener.py", line 119, in tor_opener tor = TorClient(auth_data=auth_data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/client.py", line 37, in init self._consensus = consensus or TorConsensus() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 145, in init self.renew() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 78, in newfn return func(*args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 163, in renew raw_string = authority.download('consensus', prev_hash=prev_hash) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/consesus.py", line 70, in download return http_get('{}/{}'.format(self.status_url, doc_type), headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torpy/utils.py", line 190, in http_get with opener.open(url, timeout=timeout) as response: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1347, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1321, in do_open raise URLError(err) urllib.error.URLError:

I'm running python 3.7 on mac OSX

jbrown299 commented 4 years ago

I can confirm that sometimes it happens on downloading consensus. But not always.

This error "HTTP Error 503: Directory busy, try again later" happens when tor node exceed limit for transfers... Better way is download consensus through tor network as real tor client does, but not by clearnet HTTP as torpy. Will think about it...