3 from oauthlib.common import to_unicode
6 def douban_compliance_fix(session):
9 token = json.loads(r.text)
10 token.setdefault('token_type', 'Bearer')
11 fixed_token = json.dumps(token)
12 r._content = to_unicode(fixed_token).encode('utf-8')
15 session._client_default_token_placement = 'query'
16 session.register_compliance_hook('access_token_response', fix_token_type)