When using Google AppEngine's URL fetch API it's not obvious how to do a basic digest HTTP/S authentication, so here's a self-explainable code snippet for doing so:
Other useful HTTP request headers you could add to the mheaders dict above are:import base64
username = "johnsmith"
pw = "cookie1234"
encoded = base64.b64encode(username + ':' + pw)
authstr = "Basic "+encoded
url = "https://api.del.icio.us/rename?new=bla1&old=bla2"
mheaders = {'Authorization':authstr,}
result = urlfetch.fetch(url,headers = mheaders)
both of these were very handy when implementing the del.icio.us tag cleaner."User-Agent" : "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14",
"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive": "300",
"Connection": "keep-alive",
"Accept": "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Cache-Control": "max-age=0",