Sample code for 30+ languages & platforms
Chilkat2-Python

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

http = chilkat2.Http()
cert = chilkat2.Cert()

success = http.GetServerCert("chilkatsoft.com",443,cert)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

print(cert.SubjectDN)
print(cert.ValidToStr)

# Output:

# CN=*.chilkatsoft.com
# Wed, 10 Jun 2026 23:59:59 GMT