Package zeroinstall :: Package injector :: Module download :: Class Download
[frames] | no frames]

Class Download

source code

object --+
         |
        Download

A download of a single resource to a temporary file.

Instance Methods
 
__init__(self, url, hint=None)
Create a new download object.
source code
 
start(self)
Create a temporary file and begin the download.
source code
 
abort(self)
Signal the current download to stop.
source code
int | None
get_current_fraction(self)
Returns the current fraction of this download that has been fetched (from 0 to 1), or None if the total size isn't known.
source code
int
get_bytes_downloaded_so_far(self)
Get the download progress.
source code
 
__str__(self)
str(x)
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Instance Variables
bool aborted_by_user
whether anyone has called abort
int child_pid
the child process's PID
tasks.Blocker downloaded
triggered when the download ends (on success or failure)
str errors
data received from the child's stderr
int | None expected_size
the expected final size of the file
object hint
hint passed by and for caller
(download_starting | download_fetching | download_failed | download_complete) status
the status of the download
file tempfile
the file storing the downloaded data
str url
the URL of the resource being fetched
Properties

Inherited from object: __class__

Method Details

__init__(self, url, hint=None)
(Constructor)

source code 

Create a new download object.

Parameters:
  • url - the resource to download
  • hint - object with which this download is associated (an optional hint for the GUI)
Overrides: object.__init__

Postcondition: status == download_starting.

start(self)

source code 

Create a temporary file and begin the download.

Precondition: status == download_starting

abort(self)

source code 

Signal the current download to stop.

Postcondition: aborted_by_user

get_current_fraction(self)

source code 

Returns the current fraction of this download that has been fetched (from 0 to 1), or None if the total size isn't known.

Returns: int | None
fraction downloaded

get_bytes_downloaded_so_far(self)

source code 

Get the download progress. Will be zero if the download has not yet started.

Returns: int

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)