Skip to content

AttributeError: module 'ssl' has no attribute 'wrap_socket' #53

Description

@davidshumway
> 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...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions