SSL不良握手 - AWS - 请求

时间:2017-02-02 15:31:15

标签: django python-2.7 amazon-web-services ssl python-requests

我在AWS上推出了一个使用Elastic Beanstalk的django应用程序,它在发出请求时会返回一些SSL错误.POST

我得到的错误是SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

  File "/opt/python/current/app/my_app/helpers.py", line 74, in revoke
    req = revoke_token(employee)
  File "/opt/python/current/app/my_app/helpers.py", line 96, in revoke_token
    req = requests.post(url, data=data, headers=headers)
  File "/opt/python/run/venv/lib/python2.7/site-packages/requests/api.py", line 107, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/opt/python/run/venv/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/python/run/venv/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/python/run/venv/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/opt/python/run/venv/lib/python2.7/site-packages/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

$ openssl version

OpenSSL 1.0.1k-fips 8 Jan 2015

代码导致错误

def revoke_token(employee):
    if employee.customer.is_sandbox:
        url = revoke_token_url_sandbox
    else:
        url = revoke_token_url
    data = {
                'token': employee.auth_token,
            }
    headers = {
                'content-type': 'application/x-www-form-urlencoded'
            }
    print "url - {} - data - {} - headers - {}".format(url, data, headers)
    req = requests.post(url, data=data, headers=headers)
    return req

输出打印网址,数据,标题

[Thu Feb 02 15:22:39.530520 2017] [:error] [pid 16985] url - https://login.salesforce.com/services/oauth2/revoke - data - {'token': u'00ANONYMIZEDkAQIk40FdTB6nFAhqD.ON4UBJRl5uiDoIrLMDR4DxrXt7SHDTHVL_U2lDi67thYweyl55dSkcrUvXZLheNJ_5SgH9sgNoq'} - headers - {'content-type': 'application/x-www-form-urlencoded'}

冻结

awsebcli==3.8.4
beatbox==32.1
beautifulsoup4==4.5.1
blessed==1.9.5
boto==2.43.0
botocore==1.4.75
cement==2.8.2
cffi==1.8.3
colorama==0.3.7
cryptography==1.5.2
Django==1.10.4
docker-py==1.7.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.12
enum34==1.1.6
fuzzywuzzy==0.9.0
idna==2.1
ipaddress==1.0.17
jmespath==0.9.0
ndg-httpsclient==0.4.2
oauthlib==2.0.0
pathspec==0.3.4
pep8==1.7.0
psycopg2==2.6.1
pyasn1==0.1.9
pycparser==2.17
pyOpenSSL==16.2.0
python-dateutil==2.6.0
python-Levenshtein==0.12.0
pytz==2016.6.1
PyYAML==3.12
requests==2.9.1
requests-oauthlib==0.7.0
selenium==2.53.6
semantic-version==2.5.0
simple-salesforce==0.72
six==1.10.0
texttable==0.8.7
virtualenv==15.0.2
wcwidth==0.1.7
websocket-client==0.37.0

0 个答案:

没有答案