Exemplo n.º 1
0
 def refresh_token(self, refresh_token):
     params = {
         'refresh_token': refresh_token,
         'client_id': self._client_id,
         'client_secret': self._client_secret,
         'grant_type': 'refresh_token'
     }
     return get_response(self._API_URL, params)
Exemplo n.º 2
0
 def refresh_token(self, refresh_token):
     params = {
         'refresh_token': refresh_token,
         'client_id': self._client_id,
         'client_secret': self._client_secret,
         'grant_type': 'refresh_token'
     }
     return get_response(self._url.get_absolute_url(), params)
Exemplo n.º 3
0
 def refresh_token(self, refresh_token: str):
     params = {
         "refresh_token": refresh_token,
         "client_id": self._client_id,
         "client_secret": self._client_secret,
         "grant_type": "refresh_token",
     }
     return get_response(self._url.get_absolute_url(), params)
Exemplo n.º 4
0
 def get_token(self, code, redirect_uri=None):
     params = {
         'code': code,
         'client_id': self._client_id,
         'client_secret': self._client_secret,
         'grant_type': 'authorization_code'
     }
     if redirect_uri:
         params['redirect_uri'] = redirect_uri
     return get_response(self._url.get_absolute_url(), params)
Exemplo n.º 5
0
 def get_token(self, code: str, redirect_uri: Optional[str] = None):
     params = {
         "code": code,
         "client_id": self._client_id,
         "client_secret": self._client_secret,
         "grant_type": "authorization_code",
     }
     if redirect_uri:
         params["redirect_uri"] = redirect_uri
     return get_response(self._url.get_absolute_url(), params)
Exemplo n.º 6
0
 def get_token(self, code, redirect_uri=None):
     params = {
         'code': code,
         'client_id': self._client_id,
         'client_secret': self._client_secret,
         'grant_type': 'authorization_code'
     }
     if redirect_uri:
         params['redirect_uri'] = redirect_uri
     return get_response(
         self._API_URL.format(self.get_protocol(), self._api_domain),
         params)
Exemplo n.º 7
0
 def _execute_api(self, func_name, schema_keys=None, params=None):
     if schema_keys is None:
         schema_keys = []
     if params is None:
         params = {}
     params = self.params_pre_processing(schema_keys, params)
     params = self._get_parameter(func_name, params)
     header = self.get_header(params)
     res = get_response(
         self._API_URL.format(self.get_protocol(), self._api_domain),
         params, header)
     if res['success'] == 0:
         raise Exception(res['error'])
     return res['return']
Exemplo n.º 8
0
    def _execute_api(self, func_name, schema_keys=None, params=None):
        schema_keys = schema_keys or []
        params = params or {}

        params = self._params_pre_processing(schema_keys, params, func_name)
        header = self._get_header(params)
        url = self._url.get_absolute_url()

        res = get_response(url, params, header)
        if res['success'] == 0:
            if res['error'].startswith('nonce'):
                raise ZaifApiNonceError(res['error'])
            raise ZaifApiError(res['error'])
        return res['return']