import flickrapi
api_key = '<api key>'
api_password = '<api secret>'
flickrclient = flickrapi.FlickrAPI(api_key, api_password)
favourites = flickrClient.favorites_getPublicList(user_id='132339441@N02')
photos = flickr.photos_search(user_id='132339441@N02', per_page='10')
sets = flickr.photosets_getList(user_id='132339441@N02')
for photo in favourites.photos[0].photo:
print photo['title']
错误是 Traceback(最近一次调用最后一次): 文件&#34; F:\ web \ joke.py&#34;,第5行,in favorites = flickrClient.favorites_getPublicList(user_id =&#39; 132339441 @ N02&#39;) NameError:name&#39; flickrClient&#39;未定义
答案 0 :(得分:1)
您正在使用flickrclient
和c
定义flickrClient
,其中首都为C
。
所以将flickrclient
更改为flickrClient
:
flickrClient = flickrapi.FlickrAPI(api_key, api_password)