Class: QgsNetworkContentFetcherRegistry

Registry for temporary fetched files.

This provides a simple way of downloading and accessing remote files during QGIS application running.

Added in version 3.2.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsNetworkContentFetcherRegistry

Base classes

QObject

Methods

fetch

Initialize a download for the given URL

localPath

Returns the path to a local file or to a temporary file previously fetched by the registry

class qgis.core.QgsNetworkContentFetcherRegistry[source]

Bases: QObject

__init__()

Create the registry for temporary downloaded files

FetchingMode

alias of ActionStart

fetch(self, url: str | None, fetchingMode: Qgis.ActionStart = Qgis.ActionStart.Deferred, authConfig: str | None = '', headers: QgsHttpHeaders = QgsHttpHeaders()) QgsFetchedContent | None[source]

Initialize a download for the given URL

Parameters:
  • url (Optional[str]) – the URL to be fetched

  • fetchingMode (Qgis.ActionStart = Qgis.ActionStart.Deferred) – defines if the download will start immediately or shall be manually triggered

  • authConfig (Optional[str] = '') – authentication configuration id to be used while fetching

  • headers (QgsHttpHeaders = QgsHttpHeaders()) – optional HTTP headers to add to the request (since QGIS 3.44.8)

Note

If the download starts immediately, it will not redownload any already fetched or currently fetching file.

Return type:

Optional[QgsFetchedContent]

localPath(self, filePathOrUrl: str | None) str[source]

Returns the path to a local file or to a temporary file previously fetched by the registry

Parameters:

filePathOrUrl (Optional[str]) – can either be a local file path or a remote content which has previously been fetched

Return type:

str