调用flickrapi.photosets.getPhotos方法时出错

时间:2014-09-03 07:34:33

标签: python flickr

我正在尝试在python 3.4上使用来自@sybren的flickrapi。 因此我克隆了repo的主分支并安装了包。 某些函数调用可以正常工作,但有些函数会给我这个错误:

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

对函数的调用是这样的:

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))

另一种产生相同错误的方法是:

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

任何想法我可能做错了,或者库有问题(因为python3分支仍在开发中)。

谢谢!

1 个答案:

答案 0 :(得分:2)

flickrapi期望函数的参数被命名为参数,而不是位置。这对我有用: flickr.photosets_getPhotos(photoset_id = set_id,extras =&#34; license,date_upload,date_taken&#34;)

要获取Flickr调用的参数名称列表,请参阅此处的文档:https://www.flickr.com/services/api/flickr.photosets.getPhotos.html