微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python 客户端连接到 HP ALM 12.20

如何解决Python 客户端连接到 HP ALM 12.20

我正在尝试使用请求将我的 python 客户端连接到 HP ALM,以便我可以导出缺陷和要求。 我的问题是,当我尝试连接到 ALM 时出现此错误

requests.exceptions.SSLError: HTTPSConnectionPool(host='hpalm.xxx.com',port=443): Max retries exceeded with url: /qcbin/authentication-point/authenticate (Caused by 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'}

知道我做错了什么吗? 谢谢

解决方法

这里有很多关于连接到 QC 的堆栈溢出的答案。 我建议你通过,

  1. https://github.com/macroking/ALM-Integration/blob/master/ALM_Integration_Util.py
  2. HP ALM results attachment and status update using python

这些将帮助您了解登录过程

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。