Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Del.icio.us API with python

Taken from del.icio.us-py usage here.
   1  
   2  >>> import delicious
   3  >>> # add a post, user and passwd must be valid values for del.icio.us
   4  >>> delicious.add('user', 'passwd', 'url', 'description', 'tag1 tag2', 
   5                    'extended', '2004-12-31T13:59:59Z')
   6  True
   7  >>> posts = delicious.get('user', 'passwd', count = 1)
   8  >>> # posts is a list containing the post objects, these are dicts
   9  >>> print posts
  10  [{'url': u'url', 'dt': u''2004-12-31T13:59:59Z'', 'extended': u'extended', 
  11    'description': u'description', 'tags': 'tag1 tag2'}]
  12  >>> posts[0]["tags"]
  13  'tag1 tag2'
  14  >>> delicious.delete('user', 'passwd', 'url')
  15  True
  16  >>>
  17  
  18  >>> d = delicious.DeliciousAPI("user", "passwd")
  19  >>> # DeliciousAPI offers all features of the API, see the docs for more
  20  >>> posts = d.posts_all()                 # get all posts by user
  21  >>> posts = d.posts_recent(tag = "tag1", count = 12)
  22  >>> len(posts), type(posts)
  23  (12,  <type 'dict'>)
  24  >>> 
  25  
  26  >>> d = delicious.DeliciousNOTAPI()
  27  >>> # DeliciousNOTAPI offers access to features of delicious, that are not 
  28        accessible via its api
  29  >>> posts = d.get_posts_by_user("username)
  30  >>> posts = d.get_posts_by_tag("tag")
  31  >>>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS