]> projects.mako.cc - twitter-api-cdsw/blob - requests_oauthlib/compliance_fixes/weibo.py
change variable name to make it more clear
[twitter-api-cdsw] / requests_oauthlib / compliance_fixes / weibo.py
1 from json import loads, dumps
2
3 from oauthlib.common import to_unicode
4
5
6 def weibo_compliance_fix(session):
7
8     def _missing_token_type(r):
9         token = loads(r.text)
10         token['token_type'] = 'Bearer'
11         r._content = to_unicode(dumps(token)).encode('UTF-8')
12         return r
13
14     session._client.default_token_placement = 'query'
15     session.register_compliance_hook('access_token_response',
16                                      _missing_token_type)
17     return session

Benjamin Mako Hill || Want to submit a patch?