python自签名AWS Lambda证书中的SSL错误

时间:2018-11-06 10:01:10

标签: python python-3.x ssl aws-lambda python-requests

我试图使用自签名证书来调用Web URL。但是它给出了一些涉及证书失败的错误。我将python请求用作:

import json
import requests as req
uri='someurl'
 headers= {'Authorization': 'Basic user:Welcome1' ,"content-type": "application/json","Accept":"application/json"}
r=req.get(uri,params=headers,verify='certificate.pem')
    print(r)

我也尝试生成.cer文件,但是它给出以下错误:

{
  "errorMessage": "HTTPSConnectionPool(host="host", port=443): Max retries exceeded with url: url=Basic+user%3AWelcome1&content-type=application%2Fjson&Accept=application%2Fjson (Caused by SSLError(SSLError(0, 'unknown error (_ssl.c:3517)'),))",
  "errorType": "SSLError",
  "stackTrace": [
    [
      "/var/task/lambda_function.py",
      7,
      "lambda_handler",
      "r=req.get(uri,params=headers,verify='certificate.pem')"
    ],
    [
      "/var/task/requests/api.py",
      75,
      "get",
      "return request('get', url, params=params, **kwargs)"
    ],
    [
      "/var/task/requests/api.py",
      60,
      "request",
      "return session.request(method=method, url=url, **kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      524,
      "request",
      "resp = self.send(prep, **send_kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      637,
      "send",
      "r = adapter.send(request, **kwargs)"
    ],
    [
      "/var/task/requests/adapters.py",
      514,
      "send",
      "raise SSLError(e, request=request)"
    ]
  ]
}

0 个答案:

没有答案