Spaces:
Build error
Build error
File size: 378 Bytes
70f8e84 | 1 2 3 4 5 6 7 8 9 10 11 | import ssl
import socket
def test_ssl_certificate():
hostname = "127.0.0.1"
port = 443
context = ssl.create_default_context()
with socket.create_connection((hostname, port)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
cert = ssock.getpeercert()
assert cert is not None, "No SSL certificate found!" |