MCPcopy Index your code
hub / github.com/saltstack/salt / query

Function query

salt/modules/http.py:14–47  ·  view source on GitHub ↗

.. versionadded:: 2015.5.0 Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function `: .. autofunction:: salt.utils.http.query raise_error : True If ``False``, and i

(url, **kwargs)

Source from the content-addressed store, hash-verified

12
13
14def query(url, **kwargs):
15 """
16 .. versionadded:: 2015.5.0
17
18 Query a resource, and decode the return data
19
20 Passes through all the parameters described in the
21 :py:func:`utils.http.query function <salt.utils.http.query>`:
22
23 .. autofunction:: salt.utils.http.query
24
25 raise_error : True
26 If ``False``, and if a connection cannot be made, the error will be
27 suppressed and the body of the return will simply be ``None``.
28
29 CLI Example:
30
31 .. code-block:: bash
32
33 salt '*' http.query http://somelink.com/
34 salt '*' http.query http://somelink.com/ method=POST \
35 params='{"key1": "val1", "key2": "val2"}'
36 salt '*' http.query http://somelink.com/ method=POST \
37 data='<xml>somecontent</xml>'
38 """
39 opts = __opts__.copy()
40 if "opts" in kwargs:
41 opts.update(kwargs["opts"])
42 del kwargs["opts"]
43
44 try:
45 return salt.utils.http.query(url=url, opts=opts, **kwargs)
46 except Exception as exc: # pylint: disable=broad-except
47 raise CommandExecutionError(str(exc))
48
49
50def wait_for_successful_query(url, wait_for=300, **kwargs):

Callers 1

Calls 4

queryMethod · 0.80
copyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected