[Tutor] Re: How to grab a part of web page?

Derrick 'dman' Hudson dman@dman.ddts.net
Tue, 9 Jul 2002 22:54:28 -0500


--V0207lvV8h4k8FAm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 09, 2002 at 10:47:44PM +0200, 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=20
| at 1500 byte position and ends at 2000 byte position. If the whole=20
| page has about 100 kb it seems to me waste of time to load all the=20
| page.
| What is the best, yet easy, solution?
| Is it possible to use httplib or necessary socket module?

Depending on the HTTP server at the other end, you _may_ be able to
request that the document starts at a certain byte position.  Older
servers definitely won't support that feature.  You can read up on it
in the RFCs that define HTTP/1.1.  I don't know much about it myself
other than applications will call it "resuming" a download.  Then you
could just drop the connection when you've seen as much data as you
want.

You can probably do the first part with the httplib module -- I think
it lets you specify "extra" headers to add.  I don't think you can
make it kill the connection, though.

In any case, depending on where you are and where you download the
data from, 100kb could take less than a second to transfer, and the
gain of not transfering the whole thing won't be noticeable by the
user.

-D

--=20
=20
The nice thing about windoze is - it does not just crash,
it displays a dialog box and lets you press 'ok' first.
=20
http://dman.ddts.net/~dman/


--V0207lvV8h4k8FAm
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj0rr/QACgkQO8l8XBKTpRSoJQCgj4Yrl33ZIK8pOtb98TM/093R
xh8AniC5Hhv2/lj+vXvdHAHLrJPtKxND
=TJZP
-----END PGP SIGNATURE-----

--V0207lvV8h4k8FAm--