Subgroup: File

Class: QgsFileDownloader

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

Bases: PyQt5.QtCore.QObject

QgsFileDownloader

Parameters:
  • url – the download url
  • outputFileName – file name where the downloaded content will be stored
  • authcfg – optionally apply this authentication configuration
  • delayStart – 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

New in version 3.0: Methods

cancelDownload Call to abort the download and delete this object after the cancelation 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]

Attributes

cancelDownload(self)

Call to abort the download and delete this object after the cancelation 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]

downloadExited

Emitted always when the downloader exits [signal]

downloadProgress

Emitted when data are ready to be processed [signal]

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

Called to start the download

timerEvent()