Created
January 19, 2013 16:20
-
-
Save apelliciari/4573451 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from oauth2 import Token | |
from social_auth.backends.utils import build_consumer_oauth_request | |
from social_auth.backends.facebook import FacebookAuth | |
def facebook_profile_image(user): | |
try: | |
social_auth = user.social_auth.filter(provider='facebook')[0] | |
except IndexError: | |
return [] | |
request = build_consumer_oauth_request( | |
FacebookAuth, | |
Token.from_string(social_auth.extra_data['access_token']), | |
'https://graph.facebook.com/me/picture?width=200' | |
) | |
# work on request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment