Hey guys, i was just googling some information about how to use the ClientForm package with a page which requires HTTP basic authentication and i got here :P ... So here is the problem, lets see if anyone here can help me please solving this issue
First i open the protected page using the FancyURLopener which support the HTTP basic authentication and pass this object to the ParseResponse function so it parses the corresponding forms :P
opener = urllib.FancyURL opener({})
URLStream = opener.open ( FormURL )
forms = ParseResponse(U RLStream, backwards_compa t=False)
form = forms[0]
Well, now here i fill in the form ... And finally i try to make the post using the ClientForm objects:
request2 = form.click()
response2 = urllib2.urlopen (request2)
The problem here is that i get the following exception:
"httplib.Invali dURL: nonnumeric port: 'XXXXXXXXXXXX@w ww.domain.com'"
I think that the problem here is that the ClientForm when calling click() tries to build a common urllib Request object which is obvious can't be done cause the provided url to the FancyURLopener which is from were the ClientForm retrieves the url for the Request object has the url username and password
So ... Can someone give me some hints or even better some example code to deal with this issue ?
Ps: I don't seem to have a .py file but a .egg file for the ClientForm package so i'm not able to debug or change the ClientForm source
Ps2: Sorry for the duplicate ... I also replied to other related post with this same post, but i think its important to have a separate thread for it :P
/s
First i open the protected page using the FancyURLopener which support the HTTP basic authentication and pass this object to the ParseResponse function so it parses the corresponding forms :P
opener = urllib.FancyURL opener({})
URLStream = opener.open ( FormURL )
forms = ParseResponse(U RLStream, backwards_compa t=False)
form = forms[0]
Well, now here i fill in the form ... And finally i try to make the post using the ClientForm objects:
request2 = form.click()
response2 = urllib2.urlopen (request2)
The problem here is that i get the following exception:
"httplib.Invali dURL: nonnumeric port: 'XXXXXXXXXXXX@w ww.domain.com'"
I think that the problem here is that the ClientForm when calling click() tries to build a common urllib Request object which is obvious can't be done cause the provided url to the FancyURLopener which is from were the ClientForm retrieves the url for the Request object has the url username and password
So ... Can someone give me some hints or even better some example code to deal with this issue ?
Ps: I don't seem to have a .py file but a .egg file for the ClientForm package so i'm not able to debug or change the ClientForm source
Ps2: Sorry for the duplicate ... I also replied to other related post with this same post, but i think its important to have a separate thread for it :P
/s