wiki:WikiStart

DT Flickr

DT Flickr 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

Sourcedtflickr-1.5.tar.bz223.3 kB
Eggdtflickr-1.5-py2.6.egg61.0 kB
Windows i386dtflickr-1.5.win32.exe214.1 kB
Windows amd64dtflickr-1.5.win-amd64.exe241.1 kB

More downloads are available at Python Package Index : dtflickr.

You can get the code straight from the repository:

svn co http://svn.douglasthrift.net/svn/dtflickr/trunk dtflickr

FreeBSD

On FreeBSD, you can install it from the port www/py-dtflickr:

cd /usr/ports/www/py-dtflickr
make
make install

Debian/Ubuntu

On Debian or Ubuntu, you can install it from apt.douglasthrift.net:

aptitude 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/

DT Flickr 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.
Last modified 3 years ago Last modified on Jun 26, 2011, 6:27:49 PM