@@ -32,7 +32,7 @@ class ApiClient(object):
32
32
HEADER_AUTHENTICATION = 'X-Bunq-Client-Authentication'
33
33
34
34
# Default header values
35
- _USER_AGENT_BUNQ = 'bunq-sdk-python/0.9'
35
+ _USER_AGENT_BUNQ = 'bunq-sdk-python/0.9.1 '
36
36
_GEOLOCATION_ZERO = '0 0 0 0 NL'
37
37
_LANGUAGE_EN_US = 'en_US'
38
38
_REGION_NL_NL = 'nl_NL'
@@ -66,7 +66,7 @@ def post(self, uri_relative, request_bytes, custom_headers):
66
66
:type request_bytes: bytes
67
67
:type custom_headers: dict[str, str]
68
68
69
- :return: requests.Response
69
+ :return: BunqResponseRaw
70
70
"""
71
71
72
72
return self ._request (
@@ -83,7 +83,7 @@ def _request(self, method, uri_relative, request_bytes, custom_headers):
83
83
:type request_bytes: bytes
84
84
:type custom_headers: dict[str, str]
85
85
86
- :return: requests.Response
86
+ :return: BunqResponseRaw
87
87
"""
88
88
89
89
self ._api_context .ensure_session_active ()
@@ -111,7 +111,7 @@ def _request(self, method, uri_relative, request_bytes, custom_headers):
111
111
response .headers
112
112
)
113
113
114
- return response
114
+ return self . _create_bunq_response_raw ( response )
115
115
116
116
def _get_all_headers (self , method , endpoint , request_bytes , custom_headers ):
117
117
"""
@@ -184,6 +184,16 @@ def _assert_response_success(self, response):
184
184
self ._fetch_error_messages (response )
185
185
)
186
186
187
+ @classmethod
188
+ def _create_bunq_response_raw (cls , response ):
189
+ """
190
+ :type response: requests.Response
191
+
192
+ :rtype: BunqResponseRaw
193
+ """
194
+
195
+ return BunqResponseRaw (response .content , response .headers )
196
+
187
197
def _fetch_error_messages (self , response ):
188
198
"""
189
199
:type response: requests.Response
@@ -221,7 +231,7 @@ def put(self, uri_relative, request_bytes, custom_headers):
221
231
:type request_bytes: bytes
222
232
:type custom_headers: dict[str, str]
223
233
224
- :rtype: requests.Response
234
+ :rtype: BunqResponseRaw
225
235
"""
226
236
227
237
return self ._request (
@@ -236,7 +246,7 @@ def get(self, uri_relative, custom_headers):
236
246
:type uri_relative: str
237
247
:type custom_headers: dict[str, str]
238
248
239
- :rtype: requests.Response
249
+ :rtype: BunqResponseRaw
240
250
"""
241
251
242
252
return self ._request (
@@ -251,7 +261,7 @@ def delete(self, uri_relative, custom_headers):
251
261
:type uri_relative: str
252
262
:type custom_headers: dict[str, str]
253
263
254
- :rtype: requests.Response
264
+ :rtype: BunqResponseRaw
255
265
"""
256
266
257
267
return self ._request (
@@ -260,3 +270,67 @@ def delete(self, uri_relative, custom_headers):
260
270
self ._BYTES_EMPTY ,
261
271
custom_headers
262
272
)
273
+
274
+
275
+ class BunqResponseRaw (object ):
276
+ """
277
+ :type _body_bytes: bytes
278
+ :type _headers: dict[str, str]
279
+ """
280
+
281
+ def __init__ (self , body_bytes , headers ):
282
+ """
283
+ :type body_bytes: bytes
284
+ :type headers: dict[str, str]
285
+ """
286
+
287
+ self ._body_bytes = body_bytes
288
+ self ._headers = headers
289
+
290
+ @property
291
+ def body_bytes (self ):
292
+ """
293
+ :rtype: bytes
294
+ """
295
+
296
+ return self ._body_bytes
297
+
298
+ @property
299
+ def headers (self ):
300
+ """
301
+ :rtype: dict[str, str]
302
+ """
303
+
304
+ return self ._headers
305
+
306
+
307
+ class BunqResponse (object ):
308
+ """
309
+ :type _value: T
310
+ :type _headers: dict[str, str]
311
+ """
312
+
313
+ def __init__ (self , value , headers ):
314
+ """
315
+ :type value: T
316
+ :type headers: dict[str, str]
317
+ """
318
+
319
+ self ._value = value
320
+ self ._headers = headers
321
+
322
+ @property
323
+ def value (self ):
324
+ """
325
+ :rtype: T
326
+ """
327
+
328
+ return self ._value
329
+
330
+ @property
331
+ def headers (self ):
332
+ """
333
+ :rtype: dict[str, str]
334
+ """
335
+
336
+ return self ._headers
0 commit comments