downloader.downloader module

downloader.downloader.head_request(url)[source]

Send HEAD request to given url.

Parameters:url (str) – URL of the internet resource.
Returns:Dictionary with headers. Important headers: content-length and content-type.
Return type:dict
downloader.downloader.download(url)[source]

Download resource at url.

Parameters:url (str) – URL of the internet resource.
Returns:Content of the downloaded resource.
Return type:str
downloader.downloader.progress_download(url, steps, callback)[source]

Download resource at url and call callback after each step. The number of steps is defined by steps parameter.

Parameters:
  • url (str) – URL of the internet resource.
  • steps (int) – Number of steps (how many times will be callback called).
  • callback (fn reference) – Reference to function expecting three arguments: step (number of step), downloaded (number of downloaded bytes), content_len (size of downloaded resource).