Is there a way to retrieve User and Room instances that are subscribed to some SubscriptionList?

Asked by Piotr Byzia on 2009-04-08

In [12]: session = friendfeed.FriendFeedAPI('byzia', remote_key)
In [13]: user_profile = friendfeed.FriendFeedAPI.get_user_profile(session, 'byzia')
In [14]: user_profile.lists
Out[14]:
[<SubscriptionList favorites>,
 <SubscriptionList personal>,
 <SubscriptionList professional>,
 <SubscriptionList test>]

In [15]: user_profile.lists[0].users
Out[15]: []

So, I can't get those users through user's profile and I can't find any other method to accomplish that task.

Question information

Language:
English Edit question
Status:
Solved
For:
FriendFeed PyAPI Edit question
Assignee:
No assignee Edit question
Solved by:
Chris Lasher
Solved:
2009-04-11
Last query:
2009-04-11
Last reply:
2009-04-09
Best Chris Lasher (chris.lasher) said : #1

Hi Piotr,

So the official FriendFeed API doesn't actually provide the full information about a user's subscription lists when fetching the user profile. Full information for a list (including its users, is provided by an additional call in the FriendFeed API. FF PyAPI currently mimics the official FF API, so it too requires an additional step to fetch these features.

>>> import friendfeed
>>> session = friendfeed.FriendFeedAPI('gotgenes', remotekey)
>>> user = session.get_user_profile('gotgenes')
>>> user.lists
[<SubscriptionList favorites>, <SubscriptionList local>, <SubscriptionList personal>, <SubscriptionList professional>]
>>> # Let's take a look at my professional list
...
>>> professional_list = user.lists[-1]
>>> professional_list.users
[]
>>> # OH NOES! Where are the users? Never fret, we'll fetch them now.
...
>>> professional_list = session.get_list_profile(professional_list)
>>> professional_list.users
[<User freesci>, <User sjcockell>, <User chapmanb>, <User treeoflife>, <User bryanleroylewis>, <User aswarren>, <User yokofakun>, <User pansapiens>, <User dullhunk>, <User gotgenes>, <User themza>, <User michaelbarton>, <User asu>, <User agbiotec>, <User rvidal>, <User stajich>, <User shwu>, <User pedrobeltrao>, <User drjonboyg>, <User neilfws>, <User caiyizhi>, <User njt>, <User michaelnielsen>, <User kuan>, <User nuin>, <User lfalin>, <User ejain>, <User harijay>, <User rafaelsidi>, <User sciphu>, <User i000>, <User adw>, <User joedunckley>, <User jandot>, <User stew>, <User marcosdecarvalho>, <User cameronneylon>, <User mndoci>, <User mrgunn>, <User rdmpage>, <User attilacsordas>, <User byzia>, <User behindtherabbit>, <User larsjuhljensen>]

Note while working on this answer I discovered Bug #358607; I committed a fix for this in r105 in the trunk, so you'll need to update against that for this example to work correctly. Otherwise, for this line
>>> professional_list = session.get_list_profile(professional_list)
substitute with this
>>> professional_list = session.get_list_profile(professional_list.nickname)

Piotr Byzia (piotr-byzia) said : #2

Thanks Chris Lasher, that solved my question.