idstools.net module

Module for network related operations.

idstools.net.get(url, fileobj, progress_hook=None)[source]

Perform a GET request against a URL writing the contents into the provideded file like object.

Parameters:
  • url – The URL to fetch
  • fileobj – The fileobj to write the content to
  • progress_hook – The function to call with progress updates
Returns:

Returns a tuple containing the number of bytes read and the result of the info() function from urllib2.urlopen().

Raises:

Exceptions from urllib2.urlopen() and writing to the provided fileobj may occur.