[Python-modules-commits] [python-social-auth] 279/322: Use get_json() helper

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:13:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.10
in repository python-social-auth.

commit e3f2f22d622fd5f8490c7973ad3c4abce83dd91a
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date:   Mon Apr 20 16:39:27 2015 -0300

    Use get_json() helper
---
 social/backends/changetip.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/social/backends/changetip.py b/social/backends/changetip.py
index d2e49c3..dfb8206 100644
--- a/social/backends/changetip.py
+++ b/social/backends/changetip.py
@@ -1,6 +1,4 @@
 from social.backends.oauth import BaseOAuth2
-from urllib import urlencode, urlopen
-import json
 
 
 class ChangeTipOAuth2(BaseOAuth2):
@@ -15,15 +13,15 @@ class ChangeTipOAuth2(BaseOAuth2):
 
     def get_user_details(self, response):
         """Return user details from ChangeTip account"""
-        return {'username': response['username'],
-                'email': response.get('email', '')}
+        return {
+            'username': response['username'],
+            'email': response.get('email', ''),
+            'first_name': '',
+            'last_name': '',
+        }
 
     def user_data(self, access_token, *args, **kwargs):
         """Loads user data from service"""
-        url = 'https://api.changetip.com/v2/me/?' + urlencode({
+        return self.get_json('https://api.changetip.com/v2/me/', params={
             'access_token': access_token
         })
-        try:
-            return json.load(urlopen(url))
-        except ValueError:
-            return None

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git



More information about the Python-modules-commits mailing list