How to use the smartcar.const.CONNECT_URL 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_smartcar.py View on Github external
def test_get_auth_url_test_mode_true(self):
        client = smartcar.AuthClient(self.client_id, self.client_secret,
                self.redirect_uri, self.scope, test_mode=True)
        actual = client.get_auth_url(force=True, state='stuff')
        query = urlencode({
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': 'force',
            'mode': 'test',
            'scope': ' '.join(self.scope),
            'state': 'stuff'
        })
        expected = smartcar.const.CONNECT_URL + '/oauth/authorize?' + query

        expected_params = parse_qs(expected)
        actual_params = parse_qs(actual)

        assertDeepEquals(self, expected_params, actual_params)
github smartcar / python-sdk / smartcar / smartcar.py View on Github external
single_select (bool or dictionary, optional): An optional value that
                sets the behavior of the grant dialog displayed to the user. It
                can be either a bool or dict. If set to True, `single_select` 
                limits the user to selecting only one vehicle. If `single_select`
                is a dictionary with the property `vin`, Smartcar will only authorize the vehicle
                with the specified VIN. See the [Single Select guide](https://smartcar.com/docs/guides/single-select/)
                for more information. Defaults to None.

        Returns:
            str: authorization url

        Raises:
            SmartcarException

        """
        base_url = const.CONNECT_URL

        approval_prompt = 'force' if force else 'auto'
        query = {
            'response_type': 'code',
            'client_id': self.client_id,
            'redirect_uri': self.redirect_uri,
            'approval_prompt': approval_prompt,
        }

        if self.test_mode:
            query['mode'] = 'test'

        if self.scope:
            query['scope'] = ' '.join(self.scope)

        if state: