Alan,
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
David
--- Alan G [EMAIL PROTECTED] wrote:
It runs fine but the file saved to disk is the
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
That will depend on how the protection is implemented.
If your server is a J2EE box with full
David Holland wrote:
Alan,
Sorry of course that is the problem. These pages are
password protected
Is it possible to download password protected pages (I
know the password but I don't how to get the program
to use it).
urllib2 supports basic and digest authentication. There ale
I had a look at urllib2 and I found this example :-
import urllib2
# Create an OpenerDirector with support for Basic HTTP
Authentication...
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password('realm', 'host', 'username',
'password')
opener = urllib2.build_opener(auth_handler)
Kent,
Sorry I should have put my code.
This is what I wrote
import urllib
import urllib2
f =
urllib.urlopen(http://support.mywork.co.uk/index.php?node=2371pagetree=fromid=20397objectid=21897;).read()
newfile = open(newfile.html,'w')
newfile.write(f)
newfile.close()
print 'finished'
It runs fine
David Holland wrote:
Kent,
Sorry I should have put my code.
This is what I wrote
import urllib
import urllib2
f =
urllib.urlopen(http://support.mywork.co.uk/index.php?node=2371pagetree=fromid=20397objectid=21897;).read()
newfile = open(newfile.html,'w')
newfile.write(f)
newfile.close()
It runs fine but the file saved to disk is the
information at : 'http://support.mywork.co.uk'
not
'http://support.mywork.co.uk/index.php?node=2371pagetree=fromid=20397objectid=21897;'
Could there be cookies involved?
Just a thought,
Alan G.
___
2005 6:33 a.m.
To: David Holland; tutor python
Subject: Re: [Tutor] Using urllib to retrieve info
It runs fine but the file saved to disk is the
information at : 'http://support.mywork.co.uk'
not
'http://support.mywork.co.uk/index.php?node=2371pagetree=fromid=2039
7objectid=21897'
Could