mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update documentation of fetch_url in urls.py (#23892)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
8e523089ef
commit
bb8666471d
1 changed files with 4 additions and 3 deletions
|
@ -992,7 +992,7 @@ def url_argument_spec():
|
||||||
|
|
||||||
def fetch_url(module, url, data=None, headers=None, method=None,
|
def fetch_url(module, url, data=None, headers=None, method=None,
|
||||||
use_proxy=True, force=False, last_mod_time=None, timeout=10):
|
use_proxy=True, force=False, last_mod_time=None, timeout=10):
|
||||||
'''Sends a request via HTTP(S) or FTP (needs the module as parameter)
|
"""Sends a request via HTTP(S) or FTP (needs the module as parameter)
|
||||||
|
|
||||||
:arg module: The AnsibleModule (used to get username, password etc. (s.b.).
|
:arg module: The AnsibleModule (used to get username, password etc. (s.b.).
|
||||||
:arg url: The url to use.
|
:arg url: The url to use.
|
||||||
|
@ -1012,7 +1012,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
data={...}
|
data={...}
|
||||||
resp, info = fetch_url("http://example.com",
|
resp, info = fetch_url(module,
|
||||||
|
"http://example.com",
|
||||||
data=module.jsonify(data)
|
data=module.jsonify(data)
|
||||||
header={Content-type': 'application/json'},
|
header={Content-type': 'application/json'},
|
||||||
method="POST")
|
method="POST")
|
||||||
|
@ -1020,7 +1021,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
||||||
body = resp.read()
|
body = resp.read()
|
||||||
if status_code >= 400 :
|
if status_code >= 400 :
|
||||||
body = info['body']
|
body = info['body']
|
||||||
'''
|
"""
|
||||||
|
|
||||||
if not HAS_URLPARSE:
|
if not HAS_URLPARSE:
|
||||||
module.fail_json(msg='urlparse is not installed')
|
module.fail_json(msg='urlparse is not installed')
|
||||||
|
|
Loading…
Reference in a new issue