Inconsistent result from urllib.urlopen

junkdump2861 at hotmail.com junkdump2861 at hotmail.com
Thu Apr 12 14:25:03 EDT 2007


Here's the problem:  using Netscape 7.1, I type use the view page
source command (url is http://en.wikipedia.org/wiki/Cain) and save the
raw HTML file and it's  67 kb, and has the addresses of all the images
in it.  I want the exact same thing from my Python script, but I'm not
getting it.  Instead, I get a file only 21 kb that has no image
addresses.  Here's the code I use:

import urllib
f = urllib.urlopen('http://en.wikipedia.org/wiki/Cain')
data = f.read(9999999)
f.close()
f1 = open('junk.txt', 'w')
f1.write(data)
f1.close()

Any ideas why I don't get the same result from the python script as I
do from a web browser?  This problem seems to be a recent
development.  The scripts I wrote like this worked fine for a while
and then stopped working within the past couple of weeks.




More information about the Python-list mailing list