public
Description: A Python wrapper to the Phanfare API
Homepage: http://altmansoftware.lighthouseapp.com/projects/10199-pyphanfare/overview
Clone URL: git://github.com/paltman/pyphanfare.git
Click here to lend your support to: pyphanfare and make a donation at www.pledgie.com !
name age message
file README.markdown Thu Aug 21 21:39:19 -0700 2008 updating readme [paltman]
file all_images.py Thu Aug 21 21:39:19 -0700 2008 added sample file [paltman]
directory docs/ Thu Apr 24 22:26:03 -0700 2008 updated docs [paltman]
file live_test.py Fri May 02 21:23:42 -0700 2008 updated live_test script [paltman]
file pre_commit.sh Mon Apr 21 15:00:47 -0700 2008 added script to run pylint and doc tests [paltman]
file pyphanfare.cfg Thu Aug 21 21:39:19 -0700 2008 aligned parameters [paltman]
directory pyphanfare/ Thu Aug 21 21:39:19 -0700 2008 made some stylistic/conventions based on pre_co... [paltman]
file run_tests.py Sat Apr 19 03:49:20 -0700 2008 removed copyright boilerplates [paltman]
file setup.py Sat Apr 19 03:49:20 -0700 2008 removed copyright boilerplates [paltman]
README.markdown

pyphanfare

Configuration

Configuration is handled in either a system wide configuration file placed at:

/etc/pyphanfare.cfg

or a user based configuration file at:

~/.pyphanfare

The sections available for configuring are:

[Credentials]
email = <phanfare email>
password = <phanfare password>
api_key  = <phanfare api key>
private_key = <phanfare private key>

[General]
api_url = http://www.phanfare.com/api/?
debug = True

The api_url parameters under General is optional and defaults to http://www.phanfare.com/api/? if nothing is specified in the file.

The three parameters, username, password, and api_key, under Credentials are required and are the bare minimum to be found in the configuration files.

Whatever is in the ~/.pyphanfare user file will override whatever is stored in the system /etc/pyphanfare.cfg file.

Example

While the API is not fully complete, this bit of sample code works demonstrating the ability to enumerate very quickly your entire collection on Phanfare:

from pyphanfare.connection import PhanfareConnection

def list_all():
    filesize = 0
    c = PhanfareConnection()
    c.authenticate()
    albums = c.account.get_albums()

    for album in albums:
        print album.name
        images = album.get_images(external_links=True, num_images=2000)
        for i in range(0, len(images)):
            for r in images[i].renditions:
                if r['rendition_type'] == 'Full':
                    typ = 'I'
                    if images[i].is_video:
                        typ = 'V'
                    print '%s - %s - %s - %s' % (i, typ, str(images[i].image_date), r['url'])
                    filesize += r['filesize']
        print ''
    print 'Total in storage at Phanfare: %s' % filesize

list_all()