Tuesday, 20 August 2013

Stop downloading after receiving particular amount of bytes?

Stop downloading after receiving particular amount of bytes?

Is there a way to stop downloading from a URL after a certain of bytes
have been received?
In PHP there is:
$contents = @file_get_contents($page, FALSE, NULL, 0, 40000);
The fifth argument tells file_get_contents to stop downloading after 40000
bytes. I'm basically looking for something similar in Python. A search on
Google and reading docs didn't yield anything. Help would be great, I'm
new to Python.
Thanks.

No comments:

Post a Comment