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 Loading commit data...
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
file pre_commit.sh
file pyphanfare.cfg
directory pyphanfare/
file run_tests.py
file setup.py

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()