How to use the smartcar.api 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 / tests / test_api.py View on Github external
def test_format_default(self):
        a = api.Api(
            "db848eec-6395-11e8-8b72-3b60222a171d",
            "fc93a23a-6395-11e8-808d-7b9ff2b247b1",
        )
        url = a._format("odometer")
        self.assertEqual(
            url,
            "https://api.smartcar.com/v1.0/vehicles/fc93a23a-6395-11e8-808d-7b9ff2b247b1/odometer",
        )
github smartcar / python-sdk / smartcar / smartcar.py View on Github external
""" Get a list of the user's vehicle ids

    Args:
        access_token (str): A valid access token from a previously retrieved
            access object
        limit (integer, optional): The number of vehicle ids to return
        offset (integer, optional): The index to start the vehicle list at

    Returns:
        dict: response containing the list of vehicle ids and paging information

    Raises:
        SmartcarException

    """
    return api.Api(access_token).vehicles(limit=limit, offset=offset).json()
github smartcar / python-sdk / smartcar / smartcar.py View on Github external
def get_user_id(access_token):
    """ Retrieve the userId associated with the access_token

    Args:
        access_token (str): Smartcar access token

    Returns:
        str: userId

    Raises:
        SmartcarException

    """
    return api.Api(access_token).user().json()['id']