connect to website providing login & pwd

Gerhard Häring gh_pythonlist at gmx.de
Sun Sep 30 02:23:01 EDT 2001


On Sun, Sep 30, 2001 at 06:38:59AM +0200, (-:fs) wrote:
> hi,
> 
> i'm rather new to python and try to connect to a webpage
> this works fine (i get the html-text) when the page is not secured
> 
> when it is a secure page, which requires a login and a password, how can i
> provide these ???
> [...]

Hope this helps somewhat. The following works for me:

import urllib
print urllib.urlopen("http://admin:myadminpasswd@localhost:8080/manage/").read()

The $%~]\ Zope then prints an error page saying I need a frame
compatible browser to access this page. So you can either trick Zope by
feeding it the headers it wants (most probably User-Agent) or hack the
DTML/HTML source of the page. Good luck!

I'm currently trying to unit-test a Zope Dababase Adapter. If testing is
your aim, I found useful stuff by using the keywords "unit testing" in
the Zope search engine at www.zope.org.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20010930/f04eea63/attachment.sig>


More information about the Python-list mailing list