How to grab a part of web page?

Matthew Sherborne miracle at paradise.net.nz
Thu Jul 11 01:11:24 EDT 2002


Yes you need it already on your disk for that code. I'm not sure how to 
do it with http but it is possible on most servers. You have to send it 
special headers in the request. You can see which headers by reading the 
information in this URL:

http://www.ietf.org/rfc/rfc2616.txt

Search for "partial get" and "range header".

For using httplib in python see this URL:

http://www.python.org/doc/lib/httpconnection-objects.html

Sorry I couldn't be more help. :)

GBU
Matthew Sherborne

A wrote:

>On 10 Jul 2002, at 13:47, Matthew Sherborne wrote:
>
>  
>
>>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
>>> 
>>>
>>>      
>>>
>>f = open('webpage)
>>f.seek(1500)
>>data = f.read(2000)
>>f.close()
>>
>>The operating system takes care of the efficiency for you.
>>
>>:)
>>
>>    
>>
>Thank you for your email.
>But if I use the code above I need to have webpage already on my 
>local disk. Am I right?
>
>I look forward to hearing from you soon.
>
>Best regards,
>Ladislav Blazek( Mr.)
>
>BMA TRADING Ltd.
>email: export at sendme.cz
>email2: export at bmatrading.com
>Fax:/Tel +420 506 447921
>Tel:+420 506 447920, +420 602 849309
>
>
>
>
>  
>








More information about the Python-list mailing list