pygeodes.utils.profile.Download#

class pygeodes.utils.profile.Download(url: str, destination: str | None = None, _started_at: str | None = None, _completed_at: str | None = None, _id: str | None = None)[source]#

Bases: object

This class represents a pending, current or finished Geodes download

__init__(url: str, destination: str | None = None, _started_at: str | None = None, _completed_at: str | None = None, _id: str | None = None) None#

Methods

__init__(url[, destination, _started_at, ...])

complete()

This sets the _completed_at attr to now

from_dict(dico)

This function creates a Download object from a dictionnary

start()

This method starts the download (sets _started_at to now)

to_dict()

Attributes

completed_at

This returns _completed_at as a datetime object

destination

started_at

This returns _started_at as a datetime object

time_taken

This returns the time taken to download if the download is completed

url

complete()[source]#

This sets the _completed_at attr to now

property completed_at#

This returns _completed_at as a datetime object

Returns:
datetime

completed_at

classmethod from_dict(dico: dict)[source]#

This function creates a Download object from a dictionnary

Parameters:
dicodict

a dictionnary representing a Download object

start()[source]#

This method starts the download (sets _started_at to now)

property started_at#

This returns _started_at as a datetime object

Returns:
datetime

started_at

property time_taken#

This returns the time taken to download if the download is completed

Returns:
datetime

the time taken