From: Matías Aguirre Date: Mon, 9 Jul 2012 03:16:46 +0000 (-0300) Subject: Avoid keyerror. Closes #391 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=83edd90b98a041975cbe704a2c068dc1221d31e4;p=django-social-auth.git Avoid keyerror. Closes #391 --- diff --git a/social_auth/backends/google.py b/social_auth/backends/google.py index f3bd90b..382f33e 100644 --- a/social_auth/backends/google.py +++ b/social_auth/backends/google.py @@ -58,7 +58,7 @@ class GoogleOAuthBackend(OAuthBackend): def get_user_details(self, response): """Return user details from Orkut account""" - email = response['email'] + email = response.get('email', '') return {USERNAME: email.split('@', 1)[0], 'email': email, 'fullname': '', @@ -83,7 +83,7 @@ class GoogleOAuth2Backend(GoogleOAuthBackend): return user_id def get_user_details(self, response): - email = response['email'] + email = response.get('email', '') return {USERNAME: email.split('@', 1)[0], 'email': email, 'fullname': response.get('name', ''),