logo       

[Flickr APIs] Python FlickrClient, version two: msg#00085

web.flickr.api

Subject: [Flickr APIs] Python FlickrClient, version two

Hi,
thanks to Nelson Minar for pointing me to xmltramp[1] now I have a
much better version of the client, with the bonus of exception based
error checking.

Here is a basic usage example:

client = FlickrClient(API_KEY)

person = client.flickr_people_getInfo(user_id=USER_ID)
photoSets = client.flickr_photosets_getList(user_id=USER_ID)

print person.username, "has", len(photoSets), "photosets:",
print ', '.join([str(set.title) for set in photoSets])

you access sub-element just as if they were attributes of your node,
attribute access is done as a function call on the node: person('id'),
to retrieve the text element of a node, convert it to string:
str(person.username).

In case of errors it will raise a FlickrError exception with two
attributes: code and message.


mic

[1]: http://www.aaronsw.com/2002/xmltramp/
[2]: an article with a more in-depth explanation of xmltramp
http://www.xml.com/pub/a/2003/12/17/py-xml.html

--
Michele Campeotto - www.micampe.it

You know there ain't no devil,
there's just god when he's drunk

Attachment: FlickrClient.tar.gz
Description: GNU Zip compressed data

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise