1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

remove Python2 some constructs/docs/comments (#10892)

* remove Python2 some constructs/docs/comments

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-10-11 06:15:01 +13:00 committed by GitHub
parent 5f471b8e5b
commit 633bd6133a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 22 additions and 47 deletions

View file

@ -234,17 +234,10 @@ def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=None, k
if use_tls:
kwargs = {}
if validate_certs:
try:
context = ssl.create_default_context()
kwargs["server_hostname"] = server
except AttributeError:
raise Exception('Need at least Python 2.7.9 for SSL certificate validation')
context = ssl.create_default_context()
kwargs["server_hostname"] = server
else:
if getattr(ssl, 'PROTOCOL_TLS', None) is not None:
# Supported since Python 2.7.13
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
else:
context = ssl.SSLContext()
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
context.verify_mode = ssl.CERT_NONE
irc = context.wrap_socket(irc, **kwargs)
irc.connect((server, int(port)))