(addr, ssl_version=PROTOCOL_TLS_CLIENT,
                           ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT)
return DER_cert_to_PEM_cert(dercert)
Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.
    If 'timeout' is specified, use it in the connection attempt.
Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.
    If 'timeout' is specified, use it in the connection attempt.
Retrieve the certificate from the server at the specified address and return it as a PEM - encoded string . If ca_certs is specified validate the server cert against it . If ssl_version is specified use it in the connection attempt . If timeout is specified use it in the connection attempt .
def get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT,
                           ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
    """Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.
    If 'timeout' is specified, use it in the connection attempt.
    """

    host, port = addr
    if ca_certs is not None:
        cert_reqs = CERT_REQUIRED
    else:
        cert_reqs = CERT_NONE
    context = _create_stdlib_context(ssl_version,
                                     cert_reqs=cert_reqs,
                                     cafile=ca_certs)
    with create_connection(addr, timeout=timeout) as sock:
        with context.wrap_socket(sock, server_hostname=host) as sslsock:
            dercert = sslsock.getpeercert(True)
    return DER_cert_to_PEM_cert(dercert)
def get_server_certificate ( addr , ssl_version = PROTOCOL_TLS_CLIENT , ca_certs = None , timeout = _GLOBAL_DEFAULT_TIMEOUT ) : host , port = addr if ca_certs is not None : cert_reqs = CERT_REQUIRED else : cert_reqs = CERT_NONE context = _create_stdlib_context ( ssl_version , cert_reqs = cert_reqs , cafile = ca_certs ) with create_connection ( addr , timeout = timeout ) as sock : with context . wrap_socket ( sock , server_hostname = host ) as sslsock : dercert = sslsock . getpeercert ( True ) return DER_cert_to_PEM_cert ( dercert )