How to grab a part of web page?

Ian Bicking ianb at colorstudy.com
Tue Jul 9 22:50:49 EDT 2002


I don't know if this is built in to any Python library.  You may have to
use httplib.  There are HTTP headers (which I don't remember at the
moment -- you'd have to look them up somewhere) that allow you to
request a specific byte range (though I don't believe the server has to
honor that request -- it may return the entire page).  httplib allows
(and requires) you to set all your headers.  Though it looks like you
could just use the urllib2.Request to put in your specific headers...
I'm not that familiar with that module.

You definitely don't have to use the socket module.

On Tue, 2002-07-09 at 15:47, A wrote:
> Hi,
> Is it possible to download only a part of web page?
> Say I need to find out an information about a customer that starts 
> at 1500 byte position and ends at 2000 byte position. If the whole 
> page has about 100 kb it seems to me waste of time to load all the 
> page.
> What is the best, yet easy, solution?
> Is it possible to use httplib or necessary socket module?
> Thank you for help.
> Ladislav
> 
>  
> 
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list







More information about the Python-list mailing list