import urllib2 auth_url = "http://selene.tfkyle.dyndns.org/~kyle/test4/test.py" manager = urllib2.HTTPPasswordMgr() manager.add_password("test1", auth_url, "test", "booo") opener = urllib2.build_opener(urllib2.HTTPBasicAuthHandler(manager)) print opener.open(auth_url).read()