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 !
pyphanfare / live_test.py
100644 23 lines (21 sloc) 0.969 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pyphanfare.connection import PhanfareConnection
from pyphanfare.models import ImageModes
 
con = PhanfareConnection()
con.authenticate()
 
try:
    albums = con.account.get_albums()
    relations = con.account.get_relations()
    print albums
    a = albums[0]
    print a.sections, a.groups
    print a.id, a.type, a.name, a.description, a.start_date, a.end_date, a.creation_date, a.last_modified,
    print relations
    print relations[0].first_name, relations[0].last_name, relations[0].user_id, relations[0].relation, relations[0].image_url, relations[0].premium
    images = a.get_images(ImageModes.SpecificAlbum, limit_to_album=True)
    for image in images:
        print image.id, image.filename
        for rend in image.renditions:
            print '\t', rend['rendition_type'], "%sx%s" % (rend['width'], rend['height']), rend['filesize'], "bytes", rend['media_type'], '\n\t', rend['url']
except IOError, e:
    print str(e)
    print e.errno, e.message