Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
aws lambda python套接字问题_Python_Sockets_Amazon Web Services_Ssl_Lambda - Fatal编程技术网

aws lambda python套接字问题

aws lambda python套接字问题,python,sockets,amazon-web-services,ssl,lambda,Python,Sockets,Amazon Web Services,Ssl,Lambda,我的代码是这样的,如果我通过了3个证书,它就正常工作了,但是当我把我的第4个证书添加到列表中时,我从第4个证书中得到了超时错误!!1艾米,我的代码有什么错误吗? 请帮忙,谢谢 如果您交换主机3和4,超时是发生在3号还是4号?我仍然收到错误消息。不管它是什么东道主。它只适用于前3个rest all getting timeout错误。 import time import datetime import socket import ssl all_ip = ["cert-name1", "cert

我的代码是这样的,如果我通过了3个证书,它就正常工作了,但是当我把我的第4个证书添加到列表中时,我从第4个证书中得到了超时错误!!1艾米,我的代码有什么错误吗?
请帮忙,谢谢

如果您交换主机3和4,超时是发生在3号还是4号?我仍然收到错误消息。不管它是什么东道主。它只适用于前3个rest all getting timeout错误。
import time
import datetime
import socket
import ssl
all_ip = ["cert-name1", "cert-name2","cert-name3","cert-name4"]

def ssl_expiry_datetime(hostname):
    ssl_date_fmt = r'%b %d %H:%M:%S %Y %Z'
    context = ssl.create_default_context()
    conn = context.wrap_socket(
        socket.socket(socket.AF_INET),
        server_hostname=hostname,
    )

    conn.connect((hostname, 443))
    ssl_info = conn.getpeercert()
    # parse the string from the certificate into a Python datetime object
    today_date = time.strftime(r'%b %d %H:%M:%S %Y %Z')
    b = datetime.datetime.strptime(ssl_info['notAfter'], ssl_date_fmt)
    print b - datetime.datetime.utcnow()


def lambda_handler(event,context):
    for hostname in all_ip:
        ssl_expiry_datetime(hostname)