如何解决HTTPSConnectionPool带有额外的/
我在Eclipse中使用的代码file.robot是
${resp}= Get Request localhost http://localhost:8080/UI/core/other/htmlreport/ params=apikey=${API_KEY}
那时,没有多余的/字符
但响应中带有一个额外的/
ConnectionError: HTTPSConnectionPool(host='localhost',port=443): Max retries exceeded with url: /http://localhost:8080/UI/core/other/htmlreport/?apikey=d9i7qom4p7m12rd2eqf2612s95 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000021C6BD54D90>: Failed to establish a new connection: [WinError 10061] Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd'))
放大: / http:// 多余的字符/从哪里来?
与会议有关,
但这也会在下一步中导致错误:
关键字RequestsLibrary。创建会话localhost,http:// localhost:8080 / UI / core / other / htmlreport /,params = apikey = $ {API_KEY}
Documentation:
Create Session: create a HTTP session to a server
Start / End / Elapsed:
20201104 14:55:45.917 / 20201104 14:55:45.930 / 00:00:00.013
14:55:45.918 INFO Creating Session using : alias=localhost,url=http://localhost:8080/UI/core/other/htmlreport/,headers=params=apikey=d9i7qom4p7m12rd2eqf2612s95,cookies={},auth=None,timeout=None,proxies=None,verify=False,debug=0
14:55:45.929 FAIL ValueError: not enough values to unpack (expected 2,got 1)
解决方法
文档尚不完全清楚,但是可以认为您先创建了一个会话,然后使用该会话来调用Get Request
Create Session localhost http://localhost:8080
${resp}= Get request localhost /UI/core/other/htmlreport/
您可以在代码中看到它希望会话具有模式和主机,而uri
参数是路径-https://github.com/MarketSquare/robotframework-requests/blob/c1e63fdc2738b1f95cbfd9968911261b7c8829ae/src/RequestsLibrary/RequestsKeywords.py#L990
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。