I tried this for a delicious api and it worked like a charm
import urllib2,base64
req=urllib2.Request("https://api.del.icio.us/v1/posts/update")
username="Replace with your Username"
password="Replace with your password"
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
req.add_header("Authorization", "Basic %s" % base64string)
response=urllib2.urlopen(req)
print response.read()
source
share