APIs¶
-
nornir.plugins.tasks.apis.
http_method
(task: Optional[nornir.core.task.Task] = None, method: str = 'get', url: str = '', raise_for_status: bool = True, **kwargs) → nornir.core.task.Result¶ This is a convenience task that uses requests to interact with an HTTP server.
Parameters: - method – HTTP method to call
- url – URL to connect to
- raise_for_status – Whether to call raise_for_status method automatically or not. For quick reference, raise_for_status will consider an error if the return code is any of 4xx or 5xx
- **kwargs – Keyword arguments will be passed to the request method
Returns: - result (
string/dict
): Body of the response. Either text or a dict if the response was a json object - response (
requests.Response
): Original Response
Return type: Result object with the following attributes set