我正在使用REST-Api和Python来设置一个工作流,使用项目中的请求包。
我是这个话题的新手,但我能够使用Chrome的Restlet插件来执行登录步骤。但是,对于使用请求的Python,我无法做到同样的事情。
python
import requests
from requests.auth import HTTPDigestAuth
url = 'https://my-rest-url.net/api/v2/login'
body = {"username":"testuser", "password":"testpw"}
import certifi
import urllib3
http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
myResponse = requests.post(url, data=body, verify =True, headers={'Content-Type': 'application/json', 'Host': 'my-rest-url.net'})如果我运行myResponse,我会得到Response [400],并期望它是Response [200]
我得到了以下错误:
SSLError: HTTPSConnectionPool(host=‘my url.net’,port=443): 最大重试超过url: /api/v2/登录(由SSLError(“错误握手:错误(‘SSL例程”,’tls_process_server_SSLError‘,’证书验证失败‘)引起))
注意:我已经更改了SSLError消息中的主机值和url值。
编辑:为证书添加了PoolManager。导致同样的错误。
发布于 2020-07-26 14:41:38
这是iptables的问题。将https更改为http或编辑服务器iptables,以允许所有https流量。
https://stackoverflow.com/questions/57622473
复制相似问题