A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy and authentication settings.
More...
A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy and authentication settings.
This class should be used whenever a blocking network request is required. Unlike implementations which rely on QApplication::processEvents() or creation of a QEventLoop, this class is completely thread safe and can be used on either the main thread or background threads without issue.
Redirects are automatically handled by the class.
After completion of a request, the reply content should be retrieved by calling getReplyContent(). This method returns a QgsNetworkReplyContent container, which is safe and cheap to copy and pass between threads without issue.
- Since
- QGIS 3.6
Definition at line 46 of file qgsblockingnetworkrequest.h.
Performs a "delete" operation on the specified request.
If an authCfg() has been set, then any authentication configuration required will automatically be applied to request. There is no need to manually apply the authentication to the request prior to calling this method.
The optional feedback argument can be used to abort ongoing requests.
The method will return NoError if the get operation was successful. The contents of the reply can be retrieved by calling reply().
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message can be retrieved by calling errorMessage().
- Since
- 3.18
Definition at line 97 of file qgsblockingnetworkrequest.cpp.
Performs a "get" operation on the specified request.
If forceRefresh is false
then previously cached replies may be used for the request. If it is set to true
then a new query is always performed.
If an authCfg() has been set, then any authentication configuration required will automatically be applied to request. There is no need to manually apply the authentication to the request prior to calling this method.
The optional feedback argument can be used to abort ongoing requests.
The method will return NoError if the get operation was successful. The contents of the reply can be retrieved by calling reply().
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message can be retrieved by calling errorMessage().
- See also
- post()
Definition at line 59 of file qgsblockingnetworkrequest.cpp.
Performs a "head" operation on the specified request.
If forceRefresh is false
then previously cached replies may be used for the request. If it is set to true
then a new query is always performed.
If an authCfg() has been set, then any authentication configuration required will automatically be applied to request. There is no need to manually apply the authentication to the request prior to calling this method.
The optional feedback argument can be used to abort ongoing requests.
The method will return NoError if the get operation was successful. The contents of the reply can be retrieved by calling reply().
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message can be retrieved by calling errorMessage().
- Since
- 3.18
Definition at line 78 of file qgsblockingnetworkrequest.cpp.
Performs a "post" operation on the specified request, using the given data.
If forceRefresh is false
then previously cached replies may be used for the request. If it is set to true
then a new query is always performed.
If an authCfg() has been set, then any authentication configuration required will automatically be applied to request. There is no need to manually apply the authentication to the request prior to calling this method.
The optional feedback argument can be used to abort ongoing requests.
The method will return NoError if the get operation was successful. The contents of the reply can be retrieved by calling reply().
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message can be retrieved by calling errorMessage().
- See also
- get()
- Since
- 3.22
Definition at line 72 of file qgsblockingnetworkrequest.cpp.
Performs a "put" operation on the specified request, using the given data.
If an authCfg() has been set, then any authentication configuration required will automatically be applied to request. There is no need to manually apply the authentication to the request prior to calling this method.
The optional feedback argument can be used to abort ongoing requests.
The method will return NoError if the get operation was successful. The contents of the reply can be retrieved by calling reply().
If an error was encountered then a specific ErrorCode will be returned, and a detailed error message can be retrieved by calling errorMessage().
- Since
- 3.22
Definition at line 91 of file qgsblockingnetworkrequest.cpp.