/************************************************************************ * This file has been generated automatically from * * * * src/core/qgsnetworkaccessmanager.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ class QgsNetworkRequestParameters { %Docstring Encapsulates parameters and properties of a network request. .. versionadded:: 3.6 %End %TypeHeaderCode #include "qgsnetworkaccessmanager.h" %End public: QgsNetworkRequestParameters(); %Docstring Default constructor. %End QgsNetworkRequestParameters( QNetworkAccessManager::Operation operation, const QNetworkRequest &request, int requestId ); %Docstring Constructor for QgsNetworkRequestParameters, with the specified network ``operation`` and original ``request``. %End QNetworkAccessManager::Operation operation() const; %Docstring Returns the request operation, e.g. GET or POST. %End QNetworkRequest request() const; %Docstring Returns the network request. This is the original network request sent to :py:class:`QgsNetworkAccessManager`, but with QGIS specific configuration options such as proxy handling and SSL exceptions applied. %End QString originatingThreadId() const; %Docstring Returns a string identifying the thread which the request originated from. %End int requestId() const; %Docstring Returns a unique ID identifying the request. %End }; class QgsNetworkAccessManager : QNetworkAccessManager { %Docstring network access manager for QGIS This class implements the QGIS network access manager. It's a singleton that can be used across QGIS. Plugins can insert proxy factories and thereby redirect requests to individual proxies. If no proxy factories are there or none returns a proxy for an URL a fallback proxy can be set. There's also a exclude list that defines URLs that the fallback proxy should not be used for, then no proxy will be used. .. versionadded:: 1.5 %End %TypeHeaderCode #include "qgsnetworkaccessmanager.h" %End public: static QgsNetworkAccessManager *instance( Qt::ConnectionType connectionType = Qt::BlockingQueuedConnection ); %Docstring Returns a pointer to the active QgsNetworkAccessManager for the current thread. With the ``connectionType`` parameter it is possible to setup the default connection type that is used to handle signals that might require user interaction and therefore need to be handled on the main thread. See in-depth discussion below. :param connectionType: In most cases the default of using a ``Qt.BlockingQueuedConnection`` is ok, to make a background thread wait for the main thread to answer such a request is fine and anything else is dangerous. However, in case the request was started on the main thread, one should execute a local event loop in a helper thread and freeze the main thread for the duration of the download. In this case, if an authentication request is sent from the background thread network access manager, the background thread should be blocked, the main thread be woken up, processEvents() executed once, the main thread frozen again and the background thread continued. %End QgsNetworkAccessManager( QObject *parent = 0 ); void insertProxyFactory( QNetworkProxyFactory *factory /Transfer/ ); %Docstring insert a factory into the proxy factories list %End void removeProxyFactory( QNetworkProxyFactory *factory /TransferBack/ ); %Docstring remove a factory from the proxy factories list %End const QList proxyFactories() const; %Docstring retrieve proxy factory list %End const QNetworkProxy &fallbackProxy() const; %Docstring retrieve fall back proxy (for urls that no factory returned proxies for) %End QStringList excludeList() const; %Docstring retrieve exclude list (urls shouldn't use the fallback proxy) %End void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes ); %Docstring Sets fallback proxy and URL that shouldn't use it. %End static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl control ); %Docstring Gets name for QNetworkRequest.CacheLoadControl %End static QNetworkRequest::CacheLoadControl cacheLoadControlFromName( const QString &name ); %Docstring Gets QNetworkRequest.CacheLoadControl from name %End void setupDefaultProxyAndCache( Qt::ConnectionType connectionType = Qt::BlockingQueuedConnection ); %Docstring Setup the QgsNetworkAccessManager (NAM) according to the user's settings. The ``connectionType`` sets up the default connection type that is used to handle signals that might require user interaction and therefore need to be handled on the main thread. See in-depth discussion in the documentation for the constructor of this class. %End bool useSystemProxy() const; %Docstring Returns whether the system proxy should be used %End signals: void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * ) /Deprecated/; %Docstring .. deprecated:: Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead. %End void requestAboutToBeCreated( QgsNetworkRequestParameters request ); %Docstring Emitted when a network request is about to be created. This signal is propagated to the main thread QgsNetworkAccessManager instance, so it is necessary only to connect to the main thread's signal in order to receive notifications about requests created in any thread. .. seealso:: :py:func:`finished` .. seealso:: :py:func:`requestTimedOut` .. versionadded:: 3.6 %End void finished( QgsNetworkReplyContent reply ); %Docstring This signal is emitted whenever a pending network reply is finished. The ``reply`` parameter will contain a QgsNetworkReplyContent object, containing all the useful information relating to the reply, including headers and reply content. This signal is propagated to the main thread QgsNetworkAccessManager instance, so it is necessary only to connect to the main thread's signal in order to receive notifications about requests created in any thread. .. seealso:: :py:func:`requestAboutToBeCreated` .. seealso:: :py:func:`requestTimedOut` .. versionadded:: 3.6 %End void requestTimedOut( QgsNetworkRequestParameters request ); %Docstring Emitted when a network request has timed out. This signal is propagated to the main thread QgsNetworkAccessManager instance, so it is necessary only to connect to the main thread's signal in order to receive notifications about requests created in any thread. .. seealso:: :py:func:`requestAboutToBeCreated` .. seealso:: :py:func:`finished` .. versionadded:: 3.6 %End void requestCreated( QNetworkReply * ) /Deprecated/; %Docstring .. deprecated:: Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead. %End void requestTimedOut( QNetworkReply * ); protected: virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 ); }; /************************************************************************ * This file has been generated automatically from * * * * src/core/qgsnetworkaccessmanager.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/