Source

yummy / src / scripts / ym.py

Full commit
import os
from pit import  Pit
import urllib2
from xml.dom import minidom

UA='Python yummy.py'

def main_old():
#     curl https://$DUID:$DPWD@api.del.icio.us/v1/posts/all?tag=bitbucket
#          https://            api.del.icio.us/v1/post?tags=bitbucket


    conf =Pit.get('delicious')
    auth_handler = urllib2.HTTPBasicAuthHandler()
    auth_handler.add_password("del.icio.us API", "%(api_scheme)s://%(api_host)s/" % conf, 
                            conf['username'], conf['password'])

    opener = urllib2.build_opener(auth_handler)
    opener.addheaders = [("User-agent", UA)] 
    urllib2.install_opener(opener)

   
    POST= "%(api_scheme)s://%(api_host)s/%(api_ver)s/posts/all?tag=bitbucket" % conf

    print conf
    print POST
    if False:
        return

    res = urllib2.urlopen(POST)

    xmldom = minidom.parseString(res.read())

    for post in xmldom.documentElement.childNodes:
        postdict = {}
        print "Description:", post.attributes['description'].value
        print "URL:",post.attributes['href'].value
        print ""

def main():
    from yummy.api import Api
    for post in api.post(tag='bitubuker').documentElement.childNodes:
        postdict = {}
        print "Description:", post.attributes['description'].value
        print "URL:",post.attributes['href'].value
        print ""
    
if __name__ == '__main__':
    main()