html - Python Urllib2 doesn't return the whole file -


i'm trying make script can know when page has modifications (it can't done "last-modified" because server replace file identical after days). trying use urllib2.urlopen() , .read() method string contains code, this:

try:     file= open(filedir, 'w+')     web = urllib2.urlopen(url)     file.write(web.read()) except error e:     print "some error %s" % e archivo.close() 

works fine, when try downloading same page, same without headers:

reference file:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html lang="es" xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>...

but when comes new download, get:

<meta http-equiv="content-type" content="text/html; charset=utf-8"/>...

the rest of code identical, want know it's happening. in advance.

note: happens when run script on python console or visual studio, if run script "sublime text" works fine.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -