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.
See also
List of all members, including inherited members
Class Hierarchy¶
Base classes¶
Methods
Cancels any ongoing request. |
|
Returns the fetched content as a string |
|
Returns the associated filename from the reply's content disposition header, if present. |
|
Fetches content from a remote URL and handles redirects. |
|
Returns a reference to the network reply |
|
Returns |
Signals
Emitted when data is received. |
|
Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error |
|
Emitted when content has loaded |
- class qgis.core.QgsNetworkContentFetcher[source]¶
Bases:
QObject- 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(bytesReceived: int, bytesTotal: int)[source]¶
Emitted when data is received.
Added in version 3.2.
- Parameters:
bytesReceived (int)
bytesTotal (int)
- signal errorOccurred(code: QNetworkReply.NetworkError, errorMsg: str)[source]¶
Emitted when an error with
codeerror occurred while processing the requesterrorMsgis a textual description of the errorAdded in version 3.22.
- Parameters:
code (QNetworkReply.NetworkError)
errorMsg (str)
- fetchContent(self, url: QUrl, authcfg: str | None = '', headers: QgsHttpHeaders = QgsHttpHeaders())[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
headers (
QgsHttpHeaders= QgsHttpHeaders()) – optional HTTP headers to add to the request (since QGIS 3.44.8)
fetchContent(self, request: QNetworkRequest, authcfg: Optional[str] = ‘’) Fetches content using a network
requestand handles redirects. Thefinished()signal will be emitted when content has been fetched.Optionally, authentication configuration can be set via the
authcfgargument.Added in version 3.2.