備忘録:PythonでHTTPのDigest認証を行うをほとんどそのまま。忘れないようにメモ。Python Challengeのある問題で大変役立った。 import urllib2 top_url = "www.foo.org" url = "www.foo.org/bar.html" username = "user" password = "pass" passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, top_url, username, password) authhandler = urllib2.HTTPBasicAuthHandler(passman) opener = urllib2.build_opener(authhandler) urllib2.install_