Over a million developers have joined DZone.

Del.icio.us API With Python

·
Taken from del.icio.us-py usage here.

>>> import delicious
>>> # add a post, user and passwd must be valid values for del.icio.us
>>> delicious.add('user', 'passwd', 'url', 'description', 'tag1 tag2', 
                  'extended', '2004-12-31T13:59:59Z')
True
>>> posts = delicious.get('user', 'passwd', count = 1)
>>> # posts is a list containing the post objects, these are dicts
>>> print posts
[{'url': u'url', 'dt': u''2004-12-31T13:59:59Z'', 'extended': u'extended', 
  'description': u'description', 'tags': 'tag1 tag2'}]
>>> posts[0]["tags"]
'tag1 tag2'
>>> delicious.delete('user', 'passwd', 'url')
True
>>>

>>> d = delicious.DeliciousAPI("user", "passwd")
>>> # DeliciousAPI offers all features of the API, see the docs for more
>>> posts = d.posts_all()                 # get all posts by user
>>> posts = d.posts_recent(tag = "tag1", count = 12)
>>> len(posts), type(posts)
(12,  )
>>> 

>>> d = delicious.DeliciousNOTAPI()
>>> # DeliciousNOTAPI offers access to features of delicious, that are not 
      accessible via its api
>>> posts = d.get_posts_by_user("username)
>>> posts = d.get_posts_by_tag("tag")
>>>
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}