How to use the smartcar.requester.call 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_requester.py View on Github external
def test_user_agent(self):
        self.queue(200)
        smartcar.requester.call('GET', self.URL)
        self.assertRegexpMatches(
            responses.calls[0].request.headers['User-Agent'],
            r'^Smartcar\/(\d+\.\d+\.\d+) \((\w+); (\w+)\) Python v(\d+\.\d+\.\d+)$')
github smartcar / python-sdk / smartcar / api.py View on Github external
def user(self, **params):
        """ Sends a request to /user

        Args:
            **params: parameters for the request

        Returns:
            Response: response from the request to the Smartcar API

        """
        url = '{}/{}'.format(const.API_URL, 'user')
        return requester.call('GET', url, headers=self.auth, params=params)
github smartcar / python-sdk / smartcar / api.py View on Github external
def get(self, endpoint):
        """ Sends GET requests to Smartcar API

        Args:
            endpoint (str): the Smartcar endpoint of interest

        Returns:
            Response: response from the request to the Smartcar API

        """
        url = self._format(endpoint)
        headers = self.auth
        headers[const.UNIT_SYSTEM_HEADER] = self.unit_system
        return requester.call('GET', url, headers=headers)
github smartcar / python-sdk / smartcar / smartcar.py View on Github external
access object

        Returns:
            dict: dict containing access and refresh token

        Raises:
            SmartcarException

        """
        method = 'POST'
        url = const.AUTH_URL
        data = {
            'grant_type': 'refresh_token',
            'refresh_token': refresh_token
        }
        response = requester.call(method, url, data=data, auth=self.auth).json()
        return set_expiration(response)