def _data_for_exchange(self, code=None, username=None, password=None, scope=None, user_id=None):
client_params = {
"client_id": self.api.client_id,
"client_secret": self.api.client_secret,
"redirect_uri": self.api.redirect_uri,
"grant_type": "authorization_code"
}
if code:
client_params.update(code=code)
elif username and password:
client_params.update(username=username,
password=password,
grant_type="password")
if scope:
client_params.update(scope=' '.join(scope))
elif user_id:
client_params.update(user_id=user_id)
return urlencode(client_params)
评论列表
文章目录