Hi,
I'm trying to connect to a site that requires a php login. I used the
urllib2 module in the following way:

>>> import urllib2
>>> user='xxx'
>>> password='yyy'
>>> hp = urllib2.HTTPPasswordMgr()
>>> uri = 'http://s2.ikariam.it/index.php?action=loginAvatar&function=login'
>>> hp.add_password(None, uri, user, password)
>>> opener = urllib2.build_opener(urllib2.HTTPBasicAuthHandler( hp))
>>> req = urllib2.Request(uri)
>>> opener.open(req).readlines()

Needless to say, it doesn't work. I get an html page back from the
opener saying username and/or password are invalid.
Can anyone point me in the right direction?

thanks a lot,
Daniele
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to