[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Stacktrace when downloading descriptors with python3
commit b53105e0d0d42d4b87d56667ca1abb3b154d3b27
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Apr 12 11:49:02 2018 -0700
Stacktrace when downloading descriptors with python3
Method to get response headers from urllib changed in python3. Thankfully the
new method also looks to work with python 2.7, so no need for a version check.
Traceback (most recent call last):
File "scrap.py", line 6, in <module>
desc = stem.descriptor.remote.get_server_descriptors(['9695DFC35FFEB861329B9F1AB04C46397020CE31', '847B1F850344D7876491A54892F904934E4EB85D'], compression = [Compression.LZMA, Compression.ZSTD, Compression.GZIP], endpoints = [(auth.address, auth.dir_port)]).run()
File "/home/atagar/Desktop/stem/stem/descriptor/remote.py", line 460, in run
return list(self._run(suppress))
File "/home/atagar/Desktop/stem/stem/descriptor/remote.py", line 471, in _run
raise self.error
File "/home/atagar/Desktop/stem/stem/descriptor/remote.py", line 539, in _download_descriptors
encoding = response.info().getheader('Content-Encoding')
AttributeError: 'HTTPMessage' object has no attribute 'getheader'
---
stem/descriptor/remote.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index cf1b1628..3faace4c 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -535,7 +535,7 @@ class Query(object):
)
data = response.read()
- encoding = response.info().getheader('Content-Encoding')
+ encoding = response.info().get('Content-Encoding')
# Tor doesn't include compression headers. As such when using gzip we
# need to include '32' for automatic header detection...
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits