Class: QgsFetchedContent

Holds information about fetched network content.

Added in version 3.2.

Class Hierarchy

Inheritance diagram of qgis.core.QgsFetchedContent

Base classes

QObject

Methods

authConfig

Returns the authentication configuration id use for this fetched content

cancel

Cancel the download operation.

download

Start the download

error

Returns the potential error of the download

filePath

Returns the path to the local file, an empty string if the file is not accessible yet.

status

Returns the status of the download

Signals

errorOccurred

Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error

fetched

Emitted when the file is fetched and accessible

Attributes

Downloading

Failed

Finished

NotStarted

class qgis.core.QgsFetchedContent[source]

Bases: QObject

__init__(url: str | None, file: QTemporaryFile | None = None, status: QgsFetchedContent.ContentStatus = QgsFetchedContent.NotStarted, authConfig: str | None = '')

Constructs a FetchedContent with pointer to the downloaded file and status of the download

Parameters:
  • url (Optional[str])

  • file (Optional[QTemporaryFile] = None)

  • status (QgsFetchedContent.ContentStatus = QgsFetchedContent.NotStarted)

  • authConfig (Optional[str] = '')

class ContentStatus

Bases: int

Downloading = 1
Failed = 3
Finished = 2
NotStarted = 0
authConfig(self) str[source]

Returns the authentication configuration id use for this fetched content

Return type:

str

cancel(self)[source]

Cancel the download operation.

download(self, redownload: bool = False)[source]

Start the download

Parameters:

redownload (bool = False) – if set to True, it will restart any achieved or pending download.

error(self) QNetworkReply.NetworkError[source]

Returns the potential error of the download

Return type:

QNetworkReply.NetworkError

signal errorOccurred(code: QNetworkReply.NetworkError, errorMsg: str)[source]

Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error

Added in version 3.22.

Parameters:
  • code (QNetworkReply.NetworkError)

  • errorMsg (str)

signal fetched[source]

Emitted when the file is fetched and accessible

filePath(self) str[source]

Returns the path to the local file, an empty string if the file is not accessible yet.

Return type:

str

status(self) QgsFetchedContent.ContentStatus[source]

Returns the status of the download

Return type:

QgsFetchedContent.ContentStatus