mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-15 08:21:31 +00:00
[PR #11329/d549baa5 backport][stable-12] straight up: ruff format (#11330)
straight up: ruff format (#11329)
* straight up: ruff format
* Apply suggestions from code review
(cherry picked from commit d549baa5e1)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
18c53b8bd1
commit
e530d2906a
36 changed files with 438 additions and 396 deletions
|
|
@ -16,15 +16,17 @@ try:
|
|||
except ModuleNotFoundError:
|
||||
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||
|
||||
httpd = HTTPServer(('localhost', port), SimpleHTTPRequestHandler)
|
||||
httpd = HTTPServer(("localhost", port), SimpleHTTPRequestHandler)
|
||||
try:
|
||||
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True,
|
||||
certfile=os.path.join(root_dir, 'cert.pem'),
|
||||
keyfile=os.path.join(root_dir, 'key.pem'))
|
||||
httpd.socket = ssl.wrap_socket(
|
||||
httpd.socket,
|
||||
server_side=True,
|
||||
certfile=os.path.join(root_dir, "cert.pem"),
|
||||
keyfile=os.path.join(root_dir, "key.pem"),
|
||||
)
|
||||
except AttributeError:
|
||||
# Python 3.12 or newer:
|
||||
context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
|
||||
context.load_cert_chain(certfile=os.path.join(root_dir, 'cert.pem'),
|
||||
keyfile=os.path.join(root_dir, 'key.pem'))
|
||||
context.load_cert_chain(certfile=os.path.join(root_dir, "cert.pem"), keyfile=os.path.join(root_dir, "key.pem"))
|
||||
httpd.socket = context.wrap_socket(httpd.socket)
|
||||
httpd.handle_request()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue