【发布时间】:2020-03-18 05:23:26
【问题描述】:
我正在尝试使用 requests 库向 https://app.getswift.co/api/public/v2/deliveries 发出发布请求,但出现以下错误
HTTPSConnectionPool(host='app.getswift.co', port=443): Max retries exceeded with url: /api/public/v2/deliveries (Caused by SSLError(CertificateError("hostname 'app.getswift.co' doesn't match either of '*.my_domain.ai', 'another.my_domain.ai'),))
这是我提出的要求。
headers = {
'Content-Type': 'application/json',
}
data = {
"apiKey": "my-api-key",
"booking": {
"pickupDetail": {
"name": "Rupert 1",
"phone": "1234567890",
"address": "112 luscombe st, brunswick, melbourne"
},
"dropoffDetail": {
"name": "Igor 2",
"phone": "0987654321",
"address": "105 collins st, 3000"
}
}
}
requests.post("https://app.getswift.co/api/public/v2/deliveries", headers=headers, json=data)
我在本地 python shell 上测试了相同的代码,甚至发出了邮递员请求,它工作得非常好。当我尝试将相同的代码推送到 ec2 服务器并进行发布请求调用时,问题就出现了。
我尝试使用verify=False 来查看它是否有效(即使我知道安全后果),但我却得到了"404 Not found"。
这是我在 ec2 日志中看到的内容
Not Found: /api/public/v2/deliveries
HTTP POST /api/public/v2/deliveries 404 [0.01, 127.0.0.1:57840]
https://app.getswift.co:443 "POST /api/public/v2/deliveries HTTP/1.1" 404 None
我将不胜感激。
【问题讨论】:
标签: python-3.x ssl post python-requests ssl-certificate