dtflickr
dtflickr
is a spiffy automagically built Flickr API library for Python
using JSON.
It requires Python 2.5 or higher and uses simplejson 1.7 or higher (required for Python 2.5) or the built in json module (Python 2.6 or higher if simplejson is not available). It is released under the Apache License, Version 2.0.
Download
On most platforms, you can install it with pip
:
pip install dtflickr
More information is available on PyPI.
FreeBSD
On FreeBSD, you can install it from the port www/py-dtflickr:
cd /usr/ports/www/py-dtflickr
make
make install
Or you can use pkg
instead:
pkg install py27-dtflickr
Debian/Ubuntu
On Debian or Ubuntu, you can install it from apt.douglasthrift.net:
apt-get install python-dtflickr
Documentation
Usage example:
import dtflickr
flickr = dtflickr.Flickr(api_key)
response = flickr.urls.getUserPhotos(user_id = '22264298@N00')
print response.user.url
# Output:
#
# http://www.flickr.com/photos/douglaswth/
dtflickr
also contains some utility functions to assist with some common tasks:
getPhotoSourceURL(photo, size=None)
Returns a photo source URL.
Arguments:
photo (Required)
A photo response.
size (Optional)
A size constant (SmallSquare, Thumbnail, Small, Medium (default), Large, or Original).
getWebPageProfileURL(user_id)
Returns a web page profile URL of a user.
Arguments:
user_id (Required):
The NSID or username of the user.
getWebPagePhotostreamURL(user_id)
Returns a web page photostream URL of a user.
Arguments:
user_id (Required)
The NSID or username of the user.
getBuddyiconURL(person, flickr=None)
Returns a buddyicon URL for a person.
Arguments:
person (Required)
A person response or (if the flickr argument is specified) an NSID of the user.
flickr (Optional)
A Flickr API instance used to get a person response.
getURLDetails(url)
Parses a Flickr URL and returns useful information from it or None if it is not a useful URL.
This can currently parse photo source, user profile, user photos, photo, set, and buddyicon URLs.
Arguments:
url (Required)
A Flickr URL.