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.
See also
New in version 2.5.
QgsNetworkContentFetcher() Constructor for QgsNetworkContentFetcher.
Methods
Cancels any ongoing request.
Returns the fetched content as a string
Fetches content from a remote URL and handles redirects.
Returns a reference to the network reply
Returns
True
if the fetching was canceled.Signals
Emitted when data is received.
Emitted when an error with
code
error occurred while processing the requesterrorMsg
is a textual description of the errorEmitted when content has loaded [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
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- downloadProgress¶
Emitted when data is received.
New in version 3.2: [signal]
- Parameters
bytesReceived (int) –
bytesTotal (int) –
- errorOccurred¶
Emitted when an error with
code
error occurred while processing the requesterrorMsg
is a textual description of the errorNew in version 3.22: [signal]
- Parameters
code (QNetworkReply.NetworkError) –
errorMsg (str) –
- 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. Thefinished()
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¶
Emitted when content has loaded [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