Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:39:51+00:00 2026-05-25T09:39:51+00:00

I wish to list all the sets created by this user along with the

  • 0

I wish to list all the sets created by this user along with the set id. I am using flickrApi and Python. Here’s my code. The setName is returning “none” in the output.
The elm.get(‘title’) is returning “none”.

    import flickrapi

api_key = 'APIKEY'
api_secret = 'APISECRET'

flickr = flickrapi.FlickrAPI(api_key, api_secret)

(token, frob) = flickr.get_token_part_one(perms='write')
if not token: raw_input("Press ENTER after you authorized this program")
flickr.get_token_part_two((token, frob))
try:
    favs = flickr.photosets_getList(user_id='51784048@N00')
    #favs = flickr.favorites_getPublicList(user_id = '51784048@N00')
    for elm in favs.getiterator():
        print ("id: %s secret: %s setname: %s") %(elm.get('id'), elm.get('secret'), elm.get('title')) 
except:
    raise Exception("Some error encountered!")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:39:52+00:00Added an answer on May 25, 2026 at 9:39 am

    When you’re working with flickrapi in Python, it’s frequently useful to print the XML which is returned by the API calls in order to see what’s going on. In your example, if you add:

     from xml.etree import ElementTree
    

    … at the top, and then add:

    print ElementTree.tostring(favs)
    

    … you’ll see that the structure returned is:

    <rsp stat="ok">
    <photosets page="1" pages="1" perpage="80" total="80">
        <photoset .../>
        <photoset .../>
        <photoset .../>
        <photoset ...>
    </photosets>
    </rsp>
    

    In a real application, you’d want to check the return status and check the page attributes, but to quickly get to what you want, let’s just look at the <photoset> elements. To iterate over them, you can change your loop to:

    for elm in favs.getchildren()[0]:
        print ElementTree.tostring(elm)
    

    Then you’ll see the structure of each photoset element that you’ll have to navigate. For example, one would be:

    <photoset can_comment="1"
              count_comments="0"
              count_views="34"
              date_create="1156703089"
              date_update="1297462539"
              farm="1"
              id="72157594253605858"
              needs_interstitial="0"
              photos="73" primary="226222345"
              secret="63fde66413"
              server="62"
              videos="0"
              visibility_can_see_set="1">
        <title>Birds</title>
        <description />
    </photoset>
    

    … so the title is actually stored in a title sub-element. From that, you can see that to get the information that you want, you can do:

    for elm in favs.getchildren()[0]:
        title = elm.getchildren()[0].text
        print ("id: %s secret: %s setname: %s") %(elm.get('id'), elm.get('secret'), title) 
    

    … which produces the output:

    id: 72157600139832705 secret: 4e884f3523 setname: French Creek State Park
    id: 72157600047937451 secret: d3c84ed8df setname: Las Vegas
    id: 72157594253605858 secret: 63fde66413 setname: Birds
    

    etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish to get a list of all strings that are used in a
Given the following list of descending unique numbers (3,2,1) I wish to generate all
For debug reasons, and curiosity, I wish to list all classes loaded to a
I wish to make the all the list items to be centered. or at
I wish to see the comments on all check-ins (change list) that has effected
This question is similar to How to list all tags pointing to a specific
I wish to use/embed html content (in this case a list <ul> ) at
I am building a web site that has a wish list. I want to
I have List with n items. I wish transform my list to new list,
I have a class that includes a std::list and wish to provide public begin()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.