Whats is the python urllib2 equivallent of

curl -u username:password status="abcd" http://example.com/update.json

I did this:

handle = urllib2.Request(url)
authheader =  "Basic %s" % base64.encodestring('%s:%s' % (username,
password))
handle.add_header("Authorization", authheader)

Is there a better / simpler way?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to