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
Call to abort the download and delete this object after the cancellation has been processed.
Called to start the download
Signals
Emitted when the download was canceled by the user.
Emitted when the download has completed successfully [signal]
Emitted when an error makes the download fail [signal]
Emitted always when the downloader exits [signal]
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.
See also
-
childEvent
(self, QChildEvent)¶
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
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
(self, QMetaMethod) → bool¶
-
receivers
(self, PYQT_SIGNAL) → int¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
startDownload
(self)¶ Called to start the download
-
timerEvent
(self, QTimerEvent)¶