PythonQt.Qt.QNetworkAccessManager
QNetworkAccessManager
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
The Network Access API is constructed around one QNetworkAccessManager object, which holds the common configuration and settings for the requests it sends. It contains the proxy and cache configuration, as well as the signals related to such issues, and reply signals that can be used to monitor the progress of a network operation. One QNetworkAccessManager instance should be enough for the whole Qt application. Since QNetworkAccessManager is based on QObject, it can only be used from the thread it belongs to.
Once a QNetworkAccessManager object has been created, the application can use it to send requests over the network. A group of standard functions are supplied that take a request and optional data, and each return a QNetworkReply object. The returned object is used to obtain any data returned in response to the corresponding request.
A simple download off the network could be accomplished with:
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, &QNetworkAccessManager::finished,
this, &MyClass::replyFinished);
manager->get(QNetworkRequest(QUrl("http://qt-project.org")));
QNetworkAccessManager has an asynchronous API. When the replyFinished slot above is
called, the parameter it takes is the
QNetworkReply object containing
the downloaded data as well as meta-data (headers, etc.).
Note: After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function.
Note: QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol. Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination.
A more involved example, assuming the manager is already existent, can be:
QNetworkRequest request;
request.setUrl(QUrl("http://qt-project.org"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
QNetworkReply *reply = manager->get(request);
connect(reply, &QIODevice::readyRead, this, &MyClass::slotReadyRead);
connect(reply, &QNetworkReply::errorOccurred,
this, &MyClass::slotError);
connect(reply, &QNetworkReply::sslErrors,
this, &MyClass::slotSslErrors);
Source: https://doc.qt.io/archives/qt-5.15/qnetworkaccessmanager.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
Accessible |
attribute | Any |
(shared captured text) |
CustomOperation |
attribute | Any |
(shared captured text) |
DeleteOperation |
attribute | Any |
(shared captured text) |
GetOperation |
attribute | Any |
(shared captured text) |
HeadOperation |
attribute | Any |
(shared captured text) |
NetworkAccessibility |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
NotAccessible |
attribute | Any |
(shared captured text) |
Operation |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
PostOperation |
attribute | Any |
(shared captured text) |
PutOperation |
attribute | Any |
(shared captured text) |
UnknownAccessibility |
attribute | Any |
(shared captured text) |
UnknownOperation |
attribute | Any |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
activeConfiguration |
function | (self) -> Any |
X.activeConfiguration() -> PythonQt.QtNetwork.QNetworkConfiguration (shared captured text) |
authenticationRequired |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.authenticationRequired; argument details are not documented. |
blockSignals |
function | (self, b: Any) -> bool |
X.blockSignals(b) -> bool (shared captured text) |
cache |
function | (self) -> Any |
X.cache() -> PythonQt.QtNetwork.QAbstractNetworkCache (shared captured text) |
childEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
children |
function | (self) -> tuple |
X.children() -> tuple (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
clearAccessCache |
function | (self) -> None |
Flushes the internal cache of authentication data and network connections. (shared captured text) |
configuration |
function | (self) -> Any |
X.configuration() -> PythonQt.QtNetwork.QNetworkConfiguration (shared captured text) |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
connectToHost |
function | (self, hostName: str, port: int) -> None |
X.connectToHost(hostName, port) (shared captured text) |
connectToHostEncrypted |
function | (self, hostName: str, port: int, sslConfiguration: Any) -> None |
X.connectToHostEncrypted(hostName, port, sslConfiguration) (shared captured text) |
cookieJar |
function | (self) -> Any |
X.cookieJar() -> PythonQt.QtNetwork.QNetworkCookieJar (shared captured text) |
createRequest |
function | (self, op: Any, request: Any, outgoingData: Any) -> Any |
X.createRequest(op, request, outgoingData) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
customEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
deleteLater |
function | (self) -> Any |
(shared captured text) |
deleteResource |
function | (self, request: Any) -> Any |
X.deleteResource(request) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.destroyed; argument details are not documented. |
disconnect |
function | (self, signal: Any, receiver: Any, slot: Any) -> bool |
X.disconnect(signal, receiver, slot) -> bool (shared captured text) |
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
encrypted |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.encrypted; argument details are not documented. |
event |
function | (self, event: Any) -> bool |
X.event(event) -> bool (shared captured text) |
eventFilter |
function | (self, watched: Any, event: Any) -> bool |
X.eventFilter(watched, event) -> bool (shared captured text) |
findChild |
function | (self, type: Any, name: Any) -> Any |
X.findChild(type, name) -> PythonQt.private.QObject (shared captured text) |
findChildren |
function | (self, type: Any, name: Any) -> tuple |
X.findChildren(type, name) -> tuple (shared captured text) |
finished |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.finished; argument details are not documented. |
get |
function | (self, request: Any) -> Any |
X.get(request) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
head |
function | (self, request: Any) -> Any |
X.head(request) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindowType |
function | (self) -> bool |
X.isWindowType() -> bool (shared captured text) |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
moveToThread |
function | (self, thread: Any) -> Any |
(shared captured text) |
networkAccessible |
attribute | Any |
(shared captured text) |
networkAccessibleChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.networkAccessibleChanged; argument details are not documented. |
networkSessionConnected |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.networkSessionConnected; argument details are not documented. |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.objectNameChanged; argument details are not documented. |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
post |
function | (self, request: Any, multiPart: Any) -> Any |
X.post(request, multiPart) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
preSharedKeyAuthenticationRequired |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.preSharedKeyAuthenticationRequired; argument details are not documented. |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
proxy |
function | (self) -> Any |
X.proxy() -> PythonQt.QtNetwork.QNetworkProxy (shared captured text) |
proxyAuthenticationRequired |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.proxyAuthenticationRequired; argument details are not documented. |
proxyFactory |
function | (self) -> Any |
X.proxyFactory() -> PythonQt.QtNetwork.QNetworkProxyFactory (shared captured text) |
put |
function | (self, request: Any, multiPart: Any) -> Any |
X.put(request, multiPart) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
sendCustomRequest |
function | (self, request: Any, verb: Any, data: Any) -> Any |
X.sendCustomRequest(request, verb, data) -> PythonQt.QtNetwork.QNetworkReply (shared captured text) |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setCache |
function | (self, cache: Any) -> None |
Sets the manager's network cache to be the cache specified. (shared captured text) |
setConfiguration |
function | (self, config: Any) -> None |
(shared captured text) |
setCookieJar |
function | (self, cookieJar: Any) -> None |
Sets the manager's cookie jar to be the cookieJar specified. (shared captured text) |
setNetworkAccessible |
function | (self, accessible: Any) -> None |
(shared captured text) |
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setProxy |
function | (self, proxy: Any) -> None |
Sets the proxy to be used in future requests to be proxy. (shared captured text) |
setProxyFactory |
function | (self, factory: Any) -> None |
Sets the proxy factory for this class to be factory. (shared captured text) |
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
sslErrors |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QNetworkAccessManager.sslErrors; argument details are not documented. |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
supportedSchemes |
function | (self) -> tuple |
X.supportedSchemes() -> tuple (shared captured text) |
thread |
function | (self) -> Any |
(shared captured text) |
timerEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |