The following code works in a system with python 2.4.3 and does not work in
the system with python 2.4.2.
And both the systems directly connect to the internet.
import urllib2
url = http://www.abcd.com;
username = abcd
passowrd = efgh
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(None, url, username, passowrd)
authHandler = urllib2.HTTPBasicAuthHandler(password_manager)
opener = urllib2.build_opener(authHandler)
urllib2.install_opener(opener)
pagehandle = urllib2.urlopen(url)
s = pagehandle.read()
print s
url = url+current/
pagehandle = urllib2.urlopen(url)
s = pagehandle.read()
print s
url = url+20071128.zip
pagehandle = urllib2.urlopen(url)
fp = open(hello.zip, 'wb')
a = pagehandle.readline();
while a != :
fp.write(a)
a = pagehandle.readline();
#fp.write(pagehandle.read())
fp.close()
in the system it does not run, it gives a urllib2.HTTPError : HTTP Error
401: Authorization required ecception.
With the same user name and password the code runs in another system.
Amal.
--
http://mail.python.org/mailman/listinfo/python-list