How to use the smartcar.exceptions.AuthenticationException 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
__version__,
        platform.system(),
        platform.machine(),
        platform.python_version()
    )

    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)