gpt4 book ai didi

python - 在 Amazon Linux 上运行 Dashku python 脚本时出现问题

转载 作者:太空宇宙 更新时间:2023-11-04 03:54:55 25 4
gpt4 key购买 nike

我正在尝试在运行 Amazon Linux 的 Amazon EC2 实例上运行 Dashku python 脚本。

这是我得到的错误:

[ec2-user@ip-10-231-47-166 ~]$ python dashku_53dc123bc0f9ac740b009af9.py
Traceback (most recent call last):
File "dashku_53dc123bc0f9ac740b009af9.py", line 16, in <module>
requests.post('https://dashku.com/api/transmission', data=json.dumps(payload),headers=headers)
File "/usr/lib/python2.6/site-packages/requests/api.py", line 88, in post
return request('post', url, data=data, **kwargs)
File "/usr/lib/python2.6/site-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 335, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 438, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 331, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:493: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

请注意,我调用 sudo yum install requests 并没有做太多事情,但调用 sudo yum update python-requests 确实安装了它。

该脚本在我的本地计算机上运行,​​并且根本没有修改:

# Instructions
#
# easy_install requests
# python dashku_53dc123bc0f9ac740b009af9.py
#
import requests
import json

payload = {
"bigNumber": 500,
"_id": "XXXXXX",
"apiKey": "XXXXXX"
}
headers = {'content-type': 'application/json'}

requests.post('https://dashku.com/api/transmission', data=json.dumps(payload),headers=headers)

在我的本地计算机上运行它工作正常,Dashku 也相应更新。

有什么想法吗?谢谢。

最佳答案

不确定这是否是合适的解决方案,但将 verify=False 添加到 requests.post 调用“修复”了该问题。

requests.post('https://dashku.com/api/transmission', data=json.dumps(payload),headers=headers, verify=False)

关于python - 在 Amazon Linux 上运行 Dashku python 脚本时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25089634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com