]> projects.mako.cc - yelp-api-cdsw/blob - requests_oauthlib/compliance_fixes/facebook.py
ignore the __pychache__ directory
[yelp-api-cdsw] / requests_oauthlib / compliance_fixes / facebook.py
1 from json import dumps
2 from oauthlib.common import urldecode
3
4
5 def facebook_compliance_fix(session):
6
7     def _compliance_fix(r):
8         token = dict(urldecode(r.text))
9         expires = token.get('expires')
10         if expires is not None:
11             token['expires_in'] = expires
12         token['token_type'] = 'Bearer'
13         r._content = dumps(token)
14         return r
15
16     session.register_compliance_hook('access_token_response', _compliance_fix)
17     return session

Benjamin Mako Hill || Want to submit a patch?