将html url转换为uri模块ansible

将html url转换为uri模块ansible,ansible,rally,Ansible,Rally,我希望将html url转换为ansible uri模块,当我在浏览器中加载url时,它会给出结果,但从uri模块中我会得到错误 我的网址:- =test1)&fetch=true Ansible uri模块:- uri: url: https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName = "test1")&fetch=true user: myusernam

我希望将html url转换为ansible uri模块,当我在浏览器中加载url时,它会给出结果,但从uri模块中我会得到错误

我的网址:- =test1)&fetch=true

Ansible uri模块:-

      uri:
        url: https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName = "test1")&fetch=true
        user: myusername
        password: mypass
        force_basic_auth: yes
        follow_redirects: all
        return_content: yes
        method: GET
      register: get_data
    - debug: var=get_data
我得到这个错误:-

fatal: [localhost]: FAILED! => {"cache_control": "no-cache", "cf_ray": "4dd5a65fea0cba46-ATL", "changed": false, "connection": "close", "content": "<html><body><h1>400 Bad request</h1>\nYour browser sent an invalid request.\n</body></html>\n", "content_type": "text/html", "date": "Mon, 27 May 2019 05:39:42 GMT",
fatal:[localhost]:失败!=>{“缓存控制”:“无缓存”,“cf_-ray”:“4dd5a65fea0cba46 ATL”,“更改”:false,“连接”:“关闭”,“内容”:“400错误请求\n您的浏览器发送了无效请求。\n\n”,“内容类型”:“text/html”,“日期”:“2019年5月27日星期一05:39:42 GMT”,

请帮助

我怀疑问题在于您的URL包含空格(
),这些空格不是有效的URL字符。如果我对示例web服务器运行您的代码,则在
uri
模块成功协商SSL连接后,我会看到以下错误:

任务执行期间发生异常。若要查看完整回溯,请使用-vvv。错误为:http.client.InvalidURL:URL不能包含控制字符。“/slm/webservice e/v2.0/user?query=(FirstName=“test1”)&fetch=true'(至少找到“”) 致命:[localhost]:失败!=>{“已更改”:false,“内容”:““已运行”:0,“消息”:“状态代码为-1,而不是[200]:发生未知错误:URL无法包含控件 字符。“/slm/webservice/v2.0/user?query=(FirstName=\“test1\”)&fetch=true'(至少找到“”),“redirected”:false,“status”:-1,“url”: webservice/v2.0/user?query=(FirstName=\“test1\”)&fetch=true“}

URL中的空格应为,因此您可以这样编写URL:

https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName+=+"test1")&fetch=true
https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName%20=%20"test1")&fetch=true
或者像这样:

https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName+=+"test1")&fetch=true
https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName%20=%20"test1")&fetch=true
或者,如果查询没有空格,则只需写:

https://rally1.rallydev.com/slm/webservice/v2.0/user?query=(FirstName="test1")&fetch=true