Class: QgsFileDownloader

class qgis.core.QgsFileDownloader(url: QUrl, outputFileName: str, authcfg: str = '', delayStart: bool = False)

Bases: PyQt5.QtCore.QObject

QgsFileDownloader

Parameters
  • url (QUrl) – the download url

  • outputFileName (str) – file name where the downloaded content will be stored

  • authcfg (str = '') – optionally apply this authentication configuration

  • delayStart (bool = False) – if True, the download will not be commenced immediately and must be triggered by a later call to startDownload(). This can be useful if connections need to be made to the downloader and there’s a chance the download will emit signals before these connections have been made.

QgsFileDownloader is a utility class for downloading files.

To use this class, it is necessary to pass the URL and an output file name as arguments to the constructor, the download will start immediately.

The download is asynchronous.

The object will destroy itself when the request completes, errors or is canceled. An optional authentication configuration can be specified.

Note

This class was part of the GUI library from QGIS 2.18.1 until QGIS 3.0

Methods

cancelDownload

Call to abort the download and delete this object after the cancellation has been processed.

childEvent

connectNotify

customEvent

disconnectNotify

isSignalConnected

receivers

sender

senderSignalIndex

startDownload

Called to start the download

timerEvent

Signals

downloadCanceled

Emitted when the download was canceled by the user.

downloadCompleted

Emitted when the download has completed successfully [signal]

downloadError

Emitted when an error makes the download fail [signal]

downloadExited

Emitted always when the downloader exits [signal]

downloadProgress

Emitted when data are ready to be processed [signal]

cancelDownload(self)

Call to abort the download and delete this object after the cancellation has been processed.

childEvent()
connectNotify()
customEvent()
disconnectNotify()
downloadCanceled

Emitted when the download was canceled by the user.

See also

cancelDownload() [signal]

downloadCompleted

Emitted when the download has completed successfully [signal]

downloadError

Emitted when an error makes the download fail [signal]

Parameters

errorMessages (Iterable[str]) –

downloadExited

Emitted always when the downloader exits [signal]

downloadProgress

Emitted when data are ready to be processed [signal]

Parameters
  • bytesReceived (int) –

  • bytesTotal (int) –

isSignalConnected()
receivers()
sender()
senderSignalIndex()
startDownload(self)

Called to start the download

timerEvent()