How to use the smartcar.exceptions.StateException function in smartcar

To help you get started, we’ve selected a few smartcar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smartcar / python-sdk / smartcar / requester.py View on Github external
response = requests.request(method, url, timeout=300, **kwargs)
    code = response.status_code
    body = response.json()

    if response.ok:
        return response
    elif code == 400:
        raise E.ValidationException(response)
    elif code == 401:
        raise E.AuthenticationException(response)
    elif code == 403:
        raise E.PermissionException(response)
    elif code == 404:
        raise E.ResourceNotFoundException(response)
    elif code == 409:
        raise E.StateException(response)
    elif code == 429:
        raise E.RateLimitingException(response)
    elif code == 430:
        raise E.MonthlyLimitExceeded(response)
    elif code == 500:
        raise E.ServerException(response)
    elif code == 501:
        if body['error'] == 'smartcar_not_capable_error':
            raise E.SmartcarNotCapableException(response)
        raise E.VehicleNotCapableException(response)
    elif code == 504:
        raise E.GatewayTimeoutException(response)
    else:
        response.raise_for_status()
github smartcar / python-sdk / smartcar / exceptions.py View on Github external
def __init__(self, response):
        super(StateException, self).__init__(response)
        json = response.json()
        self.code = json['code']