470,841 Members | 1,065 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,841 developers. It's quick & easy.

Python Help ... Using ClientForm package with HTTP authentication ? Is possible ?

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.FancyURLopener({})
URLStream = opener.open ( FormURL )

forms = ParseResponse(URLStream, backwards_compat=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.InvalidURL: nonnumeric port: 'XXXXXXXXXXXX@www.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
Mar 27 '06 #1
0 1934

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Raymond Hettinger | last post: by
7 posts views Thread by luigipaioro | last post: by
14 posts views Thread by Michele Simionato | last post: by
reply views Thread by Gabriel Genellina | last post: by
15 posts views Thread by kyosohma | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.