Ejemplo n.º 1
0
def get_facebook_photo(response):
    """ """
    import facebook.djangofb as facebook
    
    facebook = facebook.Facebook(settings.FACEBOOK_API_KEY, settings.FACEBOOK_API_SECRET)
    uid = response.get('id')
    user_data = facebook.users.getInfo(uid, ['first_name', 'last_name','pic_big',])[0]
    if user_data:
        img_url = user_data['pic_big']
        img_title = u'Facebook: ' + user_data['first_name'] + u' ' + user_data['last_name']
        return loadUrlImage(img_url,img_title)
    else:
        return None
Ejemplo n.º 2
0
def get_twitter_photo(response):
    """ """
    img_url = response.get('profile_image_url')
    img_url=img_url.replace('_normal.','.')
    username = response.get('screen_name')
    return loadUrlImage(img_url,u'twitter: ' + username)