api.events.v1.payload — Argus-Toolbelt 1.0 documentation

# Source code for api.events.v1.payload

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

    @register_command(extending=('events','v1','payload'))
    def get_payload(type: str, timestamp: int, customerID: int, eventID: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch specified event payload (PUBLIC)

        :param str type:
        :param int timestamp:
        :param int customerID:
        :param str eventID:
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises AccessDeniedException: on 403
        :raises ObjectNotFoundException: on 404
        :returns: {"offset": 381, "limit": 444, "responseCode": 200, "count": 124, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Voice as no sure foreign pull lawyer.", "messageTemplate": "Guy team less suffer trial.", "field": "Fund together near pass.", "parameter": {}, "timestamp": 369898676}], "currentPage": 251, "size": 493}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/events/v1/{type}/{timestamp}/{customerID}/{eventID}/payload".format(type=type, timestamp=timestamp, customerID=customerID, eventID=eventID)
        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 = {}

        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