使用自签名的Python https连接

2024-09-27 00:22:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在python脚本中实现SSL。我通过浏览页面并接受自签名的证书来获得证书,然后从Firefox导出它,并将其作为.pem保存到我的桌面上。在

代码是:

sslcertlocation = '/Users/derjur/Desktop/MYHOST.mydomain.local.pem'

idpentryurl = 'https://MYHOST.mydomain.local:443/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:amazon:webservices'

session = requests.Session()

response = session.get(idpentryurl, verify=sslcertlocation)

错误是:

^{pr2}$

MYHOST正在Windows 2008 R2下运行iis7。完整的脚本基于SAML/ADFS脚本,如本博客所述: http://blogs.aws.amazon.com/security/post/Tx1LDN0UBGJJ26Q/How-to-Implement-Federated-API-and-CLI-Access-Using-SAML-2-0-and-AD-FS#postCommentsTx1LDN0UBGJJ26Q

脚本的非SSL部分按预期工作。有趣的是,评论中没有人提到SSL。。。在


Tags: and脚本sslamazonsessionlocalsaml页面
1条回答
网友
1楼 · 发布于 2024-09-27 00:22:01

我认为你的论点是错误的。根据请求。会话(),get()发送可选参数verify-a boolean-to request()。在

根据请求。会话().request(),传递证书的参数为cert=/path/to/证书pem,它也被检查为字符串是路径,或者元组是(cert,key)对。在

相关问题 更多 >

    热门问题