2018-09-17 00:27:00 +00:00
|
|
|
from json import loads, dumps
|
|
|
|
|
|
|
|
from oauthlib.common import to_unicode
|
|
|
|
|
|
|
|
|
|
|
|
def weibo_compliance_fix(session):
|
|
|
|
def _missing_token_type(r):
|
|
|
|
token = loads(r.text)
|
2022-01-24 04:07:52 +00:00
|
|
|
token["token_type"] = "Bearer"
|
|
|
|
r._content = to_unicode(dumps(token)).encode("UTF-8")
|
2018-09-17 00:27:00 +00:00
|
|
|
return r
|
|
|
|
|
2022-01-24 04:07:52 +00:00
|
|
|
session._client.default_token_placement = "query"
|
|
|
|
session.register_compliance_hook("access_token_response", _missing_token_type)
|
2018-09-17 00:27:00 +00:00
|
|
|
return session
|