connect to website providing login & pwd
-:fs
fs at floSoft.net
Sun Sep 30 00:38:59 EDT 2001
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 ???
i use the code from httplib like this
V V V V V V V V V V V V V V V V V V V V
import httplib
import sys
import getopt
import string
opts, args = getopt.getopt(sys.argv[1:], 'd')
dl = 0
for o, a in opts:
if o == '-d': dl = dl + 1
host = '192.168.11.13:8080'
selector = '/test/manage/' >>>>>>>>>>> trying to call the manage
window of a ZOPE server
if args[0:]: host = args[0]
if args[1:]: selector = args[1]
h = httplib.HTTP()
h.set_debuglevel(dl)
h.connect(host)
h.putrequest('GET', selector)
h.putheader("login", "test") >>>>>>>>>>>>> ??????????????? doesn't
h.putheader("password", "test") >>>>>>>>>>>> ??????????????? work
h.endheaders()
status, reason, headers = h.getreply()
print 'status =', status
print 'reason =', reason
print
if headers:
for header in headers.headers: print string.strip(header)
print
print h.getfile().read()
V V V V V V V V V V V V V V V V V V V V
thanks for any help
steindl friedrich
(-:fs)
More information about the Python-list
mailing list