File: qgsblockingnetworkrequest.sip.in

package info (click to toggle)
qgis 3.40.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,181,336 kB
  • sloc: cpp: 1,593,302; python: 370,494; xml: 23,474; perl: 3,664; sh: 3,482; ansic: 2,257; sql: 2,133; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 157
file content (290 lines) | stat: -rw-r--r-- 9,595 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/network/qgsblockingnetworkrequest.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/



class QgsBlockingNetworkRequest : QObject
{
%Docstring(signature="appended")
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 :py:func:`~getReplyContent`. This method returns a
:py:class:`QgsNetworkReplyContent` container, which is safe and cheap to
copy and pass between threads without issue.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsblockingnetworkrequest.h"
%End
  public:

    enum ErrorCode
    {
      NoError,
      NetworkError,
      TimeoutError,
      ServerExceptionError,
    };

    enum class RequestFlag
    {
      EmptyResponseIsValid,
    };
    typedef QFlags<QgsBlockingNetworkRequest::RequestFlag> RequestFlags;


    explicit QgsBlockingNetworkRequest();
%Docstring
Constructor for QgsBlockingNetworkRequest
%End

    ~QgsBlockingNetworkRequest();

    ErrorCode get( QNetworkRequest &request, bool forceRefresh = false, QgsFeedback *feedback = 0, RequestFlags requestFlags = QgsBlockingNetworkRequest::RequestFlags() );
%Docstring
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 :py:func:`~QgsBlockingNetworkRequest.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 optional ``requestFlags`` argument can be used to modify the
behavior (added in QGIS 3.40).

The method will return NoError if the get operation was successful. The
contents of the reply can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.reply`.

If an error was encountered then a specific ErrorCode will be returned,
and a detailed error message can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. seealso:: :py:func:`post`
%End

    ErrorCode post( QNetworkRequest &request, QIODevice *data, bool forceRefresh = false, QgsFeedback *feedback = 0 );
%Docstring
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 :py:func:`~QgsBlockingNetworkRequest.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
:py:func:`~QgsBlockingNetworkRequest.reply`.

If an error was encountered then a specific ErrorCode will be returned,
and a detailed error message can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. seealso:: :py:func:`get`

.. versionadded:: 3.22
%End

    ErrorCode post( QNetworkRequest &request, const QByteArray &data, bool forceRefresh = false, QgsFeedback *feedback = 0 );
%Docstring
This is an overloaded function.

Performs a "post" operation on the specified ``request``, using the
given ``data``.
%End

    ErrorCode head( QNetworkRequest &request, bool forceRefresh = false, QgsFeedback *feedback = 0 );
%Docstring
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 :py:func:`~QgsBlockingNetworkRequest.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
:py:func:`~QgsBlockingNetworkRequest.reply`.

If an error was encountered then a specific ErrorCode will be returned,
and a detailed error message can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. versionadded:: 3.18
%End

    ErrorCode put( QNetworkRequest &request, QIODevice *data, QgsFeedback *feedback = 0 );
%Docstring
Performs a "put" operation on the specified ``request``, using the given
``data``.

If an :py:func:`~QgsBlockingNetworkRequest.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
:py:func:`~QgsBlockingNetworkRequest.reply`.

If an error was encountered then a specific ErrorCode will be returned,
and a detailed error message can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. versionadded:: 3.22
%End

    ErrorCode put( QNetworkRequest &request, const QByteArray &data, QgsFeedback *feedback = 0 );
%Docstring
This is an overloaded function.

Performs a "put" operation on the specified ``request``, using the given
``data``.

.. versionadded:: 3.18
%End

    ErrorCode deleteResource( QNetworkRequest &request, QgsFeedback *feedback = 0 );
%Docstring
Performs a "delete" operation on the specified ``request``.

If an :py:func:`~QgsBlockingNetworkRequest.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
:py:func:`~QgsBlockingNetworkRequest.reply`.

If an error was encountered then a specific ErrorCode will be returned,
and a detailed error message can be retrieved by calling
:py:func:`~QgsBlockingNetworkRequest.errorMessage`.

.. versionadded:: 3.18
%End

    QString errorMessage() const;
%Docstring
Returns the error message string, after a
:py:func:`~QgsBlockingNetworkRequest.get`,
:py:func:`~QgsBlockingNetworkRequest.post`,
:py:func:`~QgsBlockingNetworkRequest.head` or
:py:func:`~QgsBlockingNetworkRequest.put` request has been made.
%End

    QgsNetworkReplyContent reply() const;
%Docstring
Returns the content of the network reply, after a
:py:func:`~QgsBlockingNetworkRequest.get`,
:py:func:`~QgsBlockingNetworkRequest.post`,
:py:func:`~QgsBlockingNetworkRequest.head` or
:py:func:`~QgsBlockingNetworkRequest.put` request has been made.
%End

    QString authCfg() const;
%Docstring
Returns the authentication config id which will be used during the
request.

.. seealso:: :py:func:`setAuthCfg`
%End

    void setAuthCfg( const QString &authCfg );
%Docstring
Sets the authentication config id which should be used during the
request.

.. seealso:: :py:func:`authCfg`
%End

  public slots:

    void abort();
%Docstring
Aborts the network request immediately.
%End

  signals:

    void downloadProgress( qint64 bytesReceived, qint64 bytesTotal );
%Docstring
Emitted when when data arrives during a request.
%End

 void downloadFinished() /Deprecated/;
%Docstring
Emitted once a request has finished downloading.

.. deprecated:: 3.40

   Use the :py:func:`~QgsBlockingNetworkRequest.finished` signal instead.
%End

    void uploadProgress( qint64 bytesReceived, qint64 bytesTotal );
%Docstring
Emitted when when data are sent during a request.

.. versionadded:: 3.22
%End

    void finished();
%Docstring
Emitted once a request has finished.
%End

};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/network/qgsblockingnetworkrequest.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/