> pip3 install torpy[requests]
> python3 --version
Python 3.12.4
> uname -a
Linux fedora 6.9.7-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 27 18:11:45 UTC 2024 x86_64 GNU/Linux
test.py
from torpy.http.requests import TorRequests
with TorRequests() as tor_requests:
with tor_requests.get_session() as sess:
r = sess.get('https://example.com').text
> python3 test.py
ERROR:root:[ignored]
Traceback (most recent call last):
File "/home/david/.local/lib/python3.12/site-packages/torpy/utils.py", line 79, in newfn
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/consesus.py", line 235, in renew
raw_string = self.download_consensus(prev_hash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/consesus.py", line 183, in newfn
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/consesus.py", line 390, in download_consensus
with self._get_dir_client() as dir_client:
^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/consesus.py", line 375, in _get_dir_client
self._dir_guard, self._dir_circuit = self._create_dir_circuit(purpose='Internal dir client')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/consesus.py", line 365, in _create_dir_circuit
guard = TorGuard(router, purpose=purpose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/.local/lib/python3.12/site-packages/torpy/guard.py", line 66, in __init__
self.__tor_socket.connect()
File "/home/david/.local/lib/python3.12/site-packages/torpy/cell_socket.py", line 57, in connect
self._socket = ssl.wrap_socket(
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'
WARNING:torpy.utils:Retry with another router...
test.py