Source code for api.reports.v1.job

"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command


[docs]@register_command(extending=('reports','v1','job')) def get(limit: int = None, offset: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Lists report jobs (DEV) Returns a list of matching report jobs. :param int limit: :param int offset: :raises AuthenticationFailedException: on 401 :raises ValidationFailedException: on 412 :raises AccessDeniedException: on 403 :returns: {"offset": 43, "limit": 810, "responseCode": 200, "count": 659, "data": [{"id": 344, "flags": 667, "periodStart": 721, "periodEnd": 940, "createdByUser": {"id": 938, "customerID": 521, "userName": "normanorris", "name": "Kathryn Stewart"}, "created": 434, "finished": 917, "status": "DONE", "output": [{"timestamp": 1000326056, "text": "Itself tend anything imagine record five challenge."}], "customerID": 625, "globalCustomer": false}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Example arm teacher soon arm.", "messageTemplate": "Environment least scene hour kid.", "field": "Research entire education school.", "parameter": {}, "timestamp": 142209469}], "currentPage": 930, "size": 299} """ from requests import get from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/job".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if limit: body.update({"limit": limit}) if offset: body.update({"offset": offset}) response = get(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response
[docs]@register_command(extending=('reports','v1','job')) def generate(scheduleID: int = None, planID: int = None, reportCustomerID: int = None, flags: int = None, periodStart: int = None, periodEnd: int = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """null (DEV) :param int scheduleID: :param int planID: :param int reportCustomerID: :param int flags: :param int periodStart: :param int periodEnd: :returns: {} """ from requests import post from argus_api.exceptions import http url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/reports/v1/job".format() headers = { 'Content-Type': 'application/json', 'User-Agent': 'ArgusToolbelt/1.0' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = {} if scheduleID: body.update({"scheduleID": scheduleID}) if planID: body.update({"planID": planID}) if reportCustomerID: body.update({"reportCustomerID": reportCustomerID}) if flags: body.update({"flags": flags}) if periodStart: body.update({"periodStart": periodStart}) if periodEnd: body.update({"periodEnd": periodEnd}) response = post(url, json=body if body else None, verify=verify, headers=headers) errors = [] if response.status_code == 401: raise http.AuthenticationFailedException(response) elif response.status_code == 403: raise http.AccessDeniedException(response) elif response.status_code == 412: raise http.ValidationErrorException(response) elif response.status_code == 404: raise http.ObjectNotFoundException(response) return response.json() if json else response