[Tutor] Help with CGI login

James sendme105@hotmail.com
Thu, 16 Aug 2001 19:51:56 -0700


>From studying the suggestion offered combined with trial and error, I
managed to get something working in the browser address bar:

login_url=r'http://www.listbot.com/cgi-bin/customer?login=customer_login&' \
'js_test=new&customer_e_mail_login=addy@email.net&customer_password_login=ap
ass'

#using the above I tried the following:

login=urllib.urlopen(login_url)
print 'connected, attempting to download...'
for i in range(start, 24954):
    source_url=
'http://www.listbot.com/cgi-bin/customer?Act=view_message&list_id=' \
                'thelistname&msg_num=%i&start_num=' % (i)
    usock = urllib.urlopen(source_url)
    destfile=open(r'c:\super\msg%i.html' % (i), 'w')
    for line in usock.readlines():
      #  (here I edit out some of the html and save the file locally)
    usock.close()
    destfile.close()
    login.close()

This didn't work, I ended up downloading webpages asking me to log in again.

I then tried to combine the source_url args and login_url args into one big
url.  This works to retrieve the desired page on my browser, but my script
only downloads messages saying I require cookie support for access.  ?

Suggestions?

Thanks again,

James.