Class: QgsNetworkContentFetcher

class qgis.core.QgsNetworkContentFetcher

Bases: PyQt5.QtCore.QObject

HTTP network content fetcher. A simple method for fetching remote HTTP content and converting the content to standard formats. Url redirects are automatically handled.

New in version 2.5.

QgsNetworkContentFetcher() Constructor for QgsNetworkContentFetcher.

Methods

cancel

Cancels any ongoing request.

childEvent

connectNotify

contentAsString

Returns the fetched content as a string

contentDispositionFilename

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

customEvent

disconnectNotify

fetchContent

Fetches content from a remote URL and handles redirects.

isSignalConnected

receivers

reply

Returns a reference to the network reply

sender

senderSignalIndex

timerEvent

wasCanceled

Returns True if the fetching was canceled.

Signals

downloadProgress

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

errorOccurred

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

finished

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

cancel(self)

Cancels any ongoing request.

New in version 3.2.

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
contentAsString(self) str

Returns the fetched content as a string

Return type:

str

Returns:

string containing network content

contentDispositionFilename(self) str

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

New in version 3.28.

Return type:

str

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
downloadProgress

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

errorOccurred

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

fetchContent(self, url: QUrl, authcfg: str = '')

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 (str = '') – optional authentication configuration

fetchContent(self, request: QNetworkRequest, authcfg: 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.

New in version 3.2.

finished

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

isSignalConnected(self, QMetaMethod) bool
receivers(self, PYQT_SIGNAL) int
reply(self) QNetworkReply

Returns a reference to the network reply

Return type:

QNetworkReply

Returns:

QNetworkReply for fetched URL content

sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)
wasCanceled(self) bool

Returns True if the fetching was canceled.

New in version 3.10.

Return type:

bool