fetches the friends from twitter using the
        information on django-social-auth models
        user is an instance of UserSocialAuth

        Returns:
            collection of friend objects fetched from facebook
435991
def fetch_friends(self, user):
        

        # Fetch the token key and secret
        if USING_ALLAUTH:
            social_app = SocialApp.objects.get_current('twitter')
            consumer_key = social_app.key
            consumer_secret = social_app.secret

            oauth_token = SocialToken.objects.get(account=user, app=social_app).token
            oauth_token_secret = SocialToken.objects.get(account=user, app=social_app).token_secret
        else:
            t = TwitterBackend()
            tokens = t.tokens(user)
            oauth_token_secret = tokens['oauth_token_secret']
            oauth_token = tokens['oauth_token']

            # Consumer key and secret from settings
            consumer_key = settings.TWITTER_CONSUMER_KEY
            consumer_secret = settings.TWITTER_CONSUMER_SECRET

        # now fetch the twitter friends using `python-twitter`
        api = twitter.Api(
            consumer_key=consumer_key,
            consumer_secret=consumer_secret,
            access_token_key=oauth_token,
            access_token_secret=oauth_token_secret
        )
        return api.GetFriends()
883289
def friends(self):
        
        if self._friends is None:
            self.assert_bind_client()
            if self.friend_count > 0:
                self._friends = self.bind_client.get_athlete_friends(self.id)
            else:
                # Shortcut if we know there aren't any
                self._friends = []
        return self._friends
553901
def get_object(self, queryset=None):
        
        obj = User.objects.get(id=self.request.user.id)
        return obj
167712
def get_or_create_with_social_auth(self, social_auth):
        
        # Type check
        self.assert_user_is_social_auth_user(social_auth)

        # Fetch the record
        try:
            social_friend_list = self.filter(user_social_auth=social_auth).get()
        except:
            # if no record found, create a new one
            friend_ids = self.fetch_social_friend_ids(social_auth)

            social_friend_list = SocialFriendList()
            social_friend_list.friend_ids = friend_ids
            social_friend_list.user_social_auth = social_auth
            social_friend_list.save()

        return social_friend_list
530317
def get_contact_list(self, list_filter, skip=None, count=None, scope='graph/read'):
        
        params = {
            'filter': list_filter
        }
        if skip:
            params['skip'] = skip
        if count:
            params['count'] = count

        contact_list = _get(
            token=self.oauth.get_user_token(scope),
            uri='/user/socialgraph/contactlist?' + urllib.urlencode(params)
        )

        try:
            return json.loads(contact_list)
        except:
            raise MxitAPIException('Error parsing contact_list data')
1024953
def user(self, **params):
        
        url = 'https://userstream.twitter.com/%s/user.json' \
              % self.streamer.api_version
        self.streamer._request(url, params=params)
1316904
def tweets_for(query_type, args, per_user=None):
    
    lookup = {"query_type": query_type, "value": args[0]}
    try:
        tweets = Tweet.objects.get_for(**lookup)
    except TwitterQueryException:
        return []
    if per_user is not None:
        _tweets = defaultdict(list)
        for tweet in tweets:
            if len(_tweets[tweet.user_name]) < per_user:
                _tweets[tweet.user_name].append(tweet)
        tweets = sum(_tweets.values(), [])
        tweets.sort(key=lambda t: t.created_at, reverse=True)
    if len(args) > 1 and str(args[-1]).isdigit():
        tweets = tweets[:int(args[-1])]
    return tweets
575573
function _createUser(){
    var excludedFields = ['name', 'screen_name', 'profile_image'],
        nameparts = this.socialUserInfo.name.split(' '),
        newUser = {
        role: 'external',
        identities: {
            twitter: {
                id: this.socialUserInfo.id_str,
                accessToken: this.options.oauth_token,
                accessSecret: this.options.oauth_token_secret,
                screen_name: this.socialUserInfo.screen_name
            }
        },
        linkedidentities: ['twitter'],
        profile: {
            picture: this.socialUserInfo.profile_image_url
        },
        enabled: true,
        email: '',
        displayname: this.socialUserInfo.screen_name,
        firstname: nameparts[0],
        lastname: (nameparts.length > 1) ? nameparts[1] : ' '
    };

    _.each(profileFieldsArr, function(field){
        if(excludedFields.indexOf(field) === -1){
            newUser.profile[field] = this.socialUserInfo[field];
        }
    }.bind(this));

    return db.users.insert(newUser);
}
898709
def _lookup_users(self):
        
        return bind_api(
            api=self,
            path='/users/lookup.json',
            payload_type='user', payload_list=True,
            method='POST',
            allowed_param=['user_id', 'screen_name', 'include_entities', 'tweet_mode']
        )
485797
def get_user(self, id):
        
        try:
            return User(self._client.get_user(user_id=id)._json)
        except TweepError as e:
            if e.api_code == TWITTER_USER_NOT_FOUND_ERROR:
                return None
            raise
340455
function _getUserDetailsFromFacebook() {
    return BB
        .bind(this)
        .then(function() {
            return facebook.query()
                .get('/me?access_token=' + this.params.access_token)
                .request();
        })
        .then(function(res) {
            this.socialUserInfo = res[1];
        });
}
1206958
function _linkSocialAccount(){
    return BB.bind(this)
            .then(_loadUserFromToken)
            .then(_getUserSocialDetails)
            .then(_linkIdentity)
            .catch(function(){

                return _createSocialAccount.call(this); // Could not link account. Create one instead.
            });
}
64031
def get_users(self, attr_map=None):
        
        kwargs = {"UserPoolId":self.user_pool_id}

        response = self.client.list_users(**kwargs)
        return [self.get_user_obj(user.get('Username'),
                                  attribute_list=user.get('Attributes'),
                                  metadata={'username':user.get('Username')},
                                  attr_map=attr_map)
                for user in response.get('Users')]
570298
def get_followers(self) -> Iterator['Profile']:
        
        if not self._context.is_logged_in:
            raise LoginRequiredException("--login required to get a profile's followers.")
        self._obtain_metadata()
        yield from (Profile(self._context, node) for node in
                    self._context.graphql_node_list("37479f2b8209594dde7facb0d904896a",
                                                    {'id': str(self.userid)},
                                                    'https://www.instagram.com/' + self.username + '/',
                                                    lambda d: d['data']['user']['edge_followed_by'],
                                                    self._rhx_gis))
599197
def load_friends(self):
    
    user_friends = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/friends').text
    self.set(self.parse_friends(utilities.get_clean_dom(user_friends)))
    return self
1272448
def _get_comments(session, group_or_user_id, wall_id):
        
        return session.fetch_items("wall.getComments", Comment.from_json, count=100, owner_id=group_or_user_id, post_id=wall_id, need_likes=1)
432864
private User fetch(final String token) {
        try {
            return new DefaultFacebookClient(
                token,
                this.requestor,
                new DefaultJsonMapper(),
                Version.LATEST
            ).fetchObject(
                "me", User.class
            );
        } catch (final FacebookException ex) {
            throw new IllegalArgumentException(ex);
        }
    }