Class: QgsNetworkContentFetcher

HTTP network content fetcher.

A simple method for fetching remote HTTP content and converting the content to standard formats.

URL redirects are automatically handled.

Class Hierarchy

Inheritance diagram of qgis.core.QgsNetworkContentFetcher

Base classes

QObject

class qgis.core.QgsNetworkContentFetcher[source]

Bases: QObject

cancel(self)[source]

Cancels any ongoing request.

Added in version 3.2.

contentAsString(self) str[source]

Returns the fetched content as a string

Return type:

str

Returns:

string containing network content

contentDispositionFilename(self) str[source]

Returns the associated filename from the reply’s content disposition header, if present.

Added in version 3.28.

Return type:

str

signal downloadProgress[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal errorOccurred[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

fetchContent(self, url: QUrl, authcfg: str | None = '')[source]

Fetches content from a remote URL and handles redirects. The finished() signal will be emitted when content has been fetched.

Parameters:
  • url (QUrl) – URL to fetch

  • authcfg (Optional[str] = '') – optional authentication configuration

fetchContent(self, request: QNetworkRequest, authcfg: Optional[str] = ‘’) Fetches content using a network request and handles redirects. The finished() signal will be emitted when content has been fetched.

Optionally, authentication configuration can be set via the authcfg argument.

Added in version 3.2.

signal finished[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

reply(self) QNetworkReply | None[source]

Returns a reference to the network reply

Return type:

Optional[QNetworkReply]

Returns:

QNetworkReply for fetched URL content

wasCanceled(self) bool[source]

Returns True if the fetching was canceled.

Added in version 3.10.

Return type:

bool