Search code examples
pythonflickr

Error when calling flickrapi.photosets.getPhotos method


I am trying to use flickrapi from @sybren on python 3.4. Therefore i cloned the main branch of the repo and installed the package. Some function calls do work, but some give me this error:

Traceback (most recent call last):
  File "D:\personal works\flickrWorks\flickr_derpage.py", line 20, in <module>
    flickr.photosets.getPhotos(set_id)
TypeError: __call__() takes 1 positional argument but 2 were given

The call to the function is this one:

import flickrapi
import xml.etree.ElementTree as ET

# config stuff
api_key = 'fuhsdkjfsdjkfsjk'
api_secret = 'fdjksnfkjsdnfkj'
user_tbp_dev = "fednkjfnsdjkfnjksdn5"

# le program
flickr = flickrapi.FlickrAPI(api_key, api_secret)
sets = flickr.photosets.getList(user_id=user_tbp_dev)
set0 = sets.find('photosets').findall('photoset')
set_id = set0[0].get('id')

sett_photos = flickr.photosets.getPhotos(set_id)
print(ET.dump(sett_photos))

Another method which gives the same error is:

flickr.reflection.getMethodInfo("flickr.photos.search")

Any ideas what might i do wrong, or if the library has some issues (as the python3 branch is still under development).

Thanks!


Solution

  • The flickrapi expects the parameters to the functions to be named arguments, not positional. This works for me: flickr.photosets_getPhotos(photoset_id=set_id, extras="license, date_upload, date_taken")

    To get a list of the argument names for the Flickr calls, see the documentation here: https://www.flickr.com/services/api/flickr.photosets.getPhotos.html