使用Python从www.flickr.com账户读取图片
好的,我需要创建一个应用程序,我想从 www.flickr.com 账户中读取图片,然后在我的 Python 应用里使用这些图片。我该怎么做呢?有没有什么建议?谢谢。
1 个回答
9
你可以使用一些不同的Flickr Python库来帮助你:
- http://code.google.com/p/flickrpy/
- http://pypi.python.org/pypi/Flickr.API/
- http://stuvel.eu/projects/flickrapi
如果你想了解Flickr的API(应用程序接口),可以查看官方文档:http://www.flickr.com/services/api/
这里有一个例子:
import flickrapi
api_key = 'API KEY YYYYYYYYYY' # you will need a key
api_password = 'your secret'
flickrClient = flickrapi.FlickrAPI(api_key, api_password)
# now you could use the methods on this client
# flickrClient.methodname(param)
favourites = flickrClient.favorites_getPublicList(user_id='userid')
# Get the title of the photos
for photo in favourites.photos[0].photo:
print photo['title']
[编辑:]
关于身份验证的内容可以查看这里:http://stuvel.eu/flickrapi/documentation/#authentication