Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #6268

ssl.wrap_socket?

From Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Newsgroups de.comp.lang.python
Subject ssl.wrap_socket?
Date 2025-03-23 01:29 +0000
Organization University of Stuttgart, FRG
Message-ID <vrno65$k58$1@rusnews.informatik.uni-stuttgart.de> (permalink)

Show all headers | View raw


Ich bin dabei ein altes Python2 Programm auf Python3 umzuschreiben.
Ich bekomme da diese Warnung:

/local/home/framstag/python/./fexit.py:905: DeprecationWarning: ssl.wrap_socket() is deprecated, use SSLContext.wrap_socket()

Der Code an dieser Stelle ist:

    sock = ssl.wrap_socket(sock)

Wenn ich das aendere in:

    sock = ssl.SSLContext.wrap_socket(sock)

bricht mir das Programm ab mit dieser Fehlermeldung:

  File "/local/home/framstag/python/./fexit.py", line 905, in http_connect
    sock = ssl.SSLContext.wrap_socket(sock)
TypeError: SSLContext.wrap_socket() missing 1 required positional argument: 'sock'


Ich hab da wohl was nicht verstanden. Wie gehts richtig?


sock hatte ich so erzeugt:

    sock = socket.create_connection((server,port))

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/

Back to de.comp.lang.python | Previous | NextNext in thread | Find similar


Thread

ssl.wrap_socket? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2025-03-23 01:29 +0000
  [Python-de] Re: ssl.wrap_socket? Christopher Arndt <chris@chrisarndt.de> - 2025-03-23 03:42 +0100
    Re: [Python-de] Re: ssl.wrap_socket? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2025-03-23 09:11 +0000
      Re: [Python-de] Re: ssl.wrap_socket? "Peter J. Holzer" <hjp-usenet4@hjp.at> - 2025-03-23 10:38 +0100
        Re: [Python-de] Re: ssl.wrap_socket? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2025-03-23 10:08 +0000
          Re: [Python-de] Re: ssl.wrap_socket? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2025-03-23 10:29 +0000
          [Python-de] Re: ssl.wrap_socket? Hartmut Goebel <h.goebel@goebel-consult.de> - 2025-03-23 16:25 +0100

csiph-web