lastlegion / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

[patch] Implement friends/ids API call #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Since it was missing from the module, I wrote a method to implement the
"friends/ids" API call, see:
http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-friends%C2%A0ids
for more info.
{{{
def GetFriendIDs(self, user=None, page=None):
    '''
    Returns a list of numeric id's for every user
    the specified user is following.

    Args:
        user:
            The id or screen_name of the user to retrieve the friends id list
            for. [optional]
        page:
            Specifies the page number of the results beginning at 1. A single
            page contains 5000 id's. This is recommended for users with
large id
            lists. If not provided all id's are returned. (Please note that the
            result set isn't guaranteed to be 5000 every time as suspended
users
            will be filtered out.) [optional]

    Returns:
        A list of integers, one for each user id.
    '''
    if not user and not self._username:
        raise TwitterError("twitter.Api instance must be authenticated")
    if user:
        url = 'http://twitter.com/friends/ids/%s.json' % user 
    else:
        url = 'http://twitter.com/friends/ids.json'
    parameters = {}
    if page:
        parameters['page'] = page
    json = self._FetchUrl(url, parameters=parameters)
    data = simplejson.loads(json)
    self._CheckForTwitterError(data)
    return data
}}}
Would be nice if this could me added to python-twitter.

Original issue reported on code.google.com by markus.m...@gmail.com on 12 Sep 2009 at 11:57

GoogleCodeExporter commented 9 years ago
Uhm, I thought the issue tracker used the same markup syntax as the wiki. I am
attaching the method as a separate file too. The method should be added to the
twitter.Api class.

Original comment by markus.m...@gmail.com on 12 Sep 2009 at 11:59

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by dclinton on 18 Sep 2009 at 2:34

GoogleCodeExporter commented 9 years ago
patch applied to changeset 
http://code.google.com/p/python-twitter/source/detail?
r=86eec8548c492d9fe4fcf8c1f4213125667e0fee

Original comment by bear42 on 24 Jan 2010 at 10:13