【发布时间】:2021-06-04 09:43:01
【问题描述】:
我正在尝试使用请求将我的 python 客户端连接到 HP ALM,以便导出缺陷和要求。 我的问题是当我尝试连接到 ALM 时出现此错误。
requests.exceptions.SSLError: HTTPSConnectionPool(host='hpalm.xxx.com', port=443): url: /qcbin/authentication-point/authenticate 超过最大重试次数(由 SSLError(SSLError("bad handshake : 错误([('SSL 例程', 'tls_process_server_certificate', '证书验证失败')])")))
我的功能如下
def connection():
#HardCoded login to be deleted when tested and able to run with login verification
user = userPass.user()
pwd = userPass.passwd()
#Not sure if needed, need to test
encPwd = base64.standard_b64encode(pwd.encode('utf-8'))
print(encPwd)
userToEncode=user+':'+pwd
print("user2Encode : {0}", userToEncode)
#requests lib to ALM connection
headers = {
'cache-control': "no-cache",
'Accept': "application/json",
'Content-Type': "application/json"
}
authurl = almURL + "/authentication-point/authenticate"
res = requests.post(authurl, auth=HTTPBasicAuth(user,encPwd),headers = headers)
到目前为止,我已尝试遵循此示例:https://github.com/vkosuri/py-hpalm/blob/master/hpalm/hpalm.py 但是当我执行 verify=False 时,我得到:
InsecureRequestWarning:正在发出未经验证的 HTTPS 请求。强烈建议添加证书验证。见:https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings 不安全请求警告)
以及以下打印的日志:
{'Date': 'Fri, 05 Mar 2021 17:36:51 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/html; charset=ISO-8859-1', 'Cache-Control': 'must-revalidate,no-cache,no-store', 'Content-Length': '5937', 'Connection': 'close'}
任何想法我做错了什么? 谢谢
【问题讨论】:
标签: python restful-authentication alm