api.world.v1.timezone — Argus-Toolbelt 1.0 documentation

# Source code for api.world.v1.timezone

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

    @register_command(extending=('world','v1','timezone'))
    def get_time_zones(keywords: list = None, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Get all time zones (PUBLIC)

        :param list keywords: Filter time zones by keywords
        :param int offset: Skip a number of time zones
        :param int limit: Maximum number of returned time zones
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 354, "limit": 635, "responseCode": 200, "count": 748, "data": [{"description": "Check body grow all message."}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "East learn meet to law.", "messageTemplate": "She blood whether capital.", "field": "Among fund power home blood customer.", "parameter": {}, "timestamp": 633676492}], "currentPage": 871, "size": 478}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/world/v1/timezone".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 offset:
            body.update({"offset": offset})

        if limit:
            body.update({"limit": limit})

        if keywords:
            body.update({"keywords": keywords})

        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