Show More
@@ -83,10 +83,14 b' def build_data(apikey, method, **kw):' | |||||
83 | }) |
|
83 | }) | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | def api_call(app, params, status=None): |
|
86 | def api_call(app, params, status=None, assert_no_error=False): | |
87 | response = app.post( |
|
87 | response = app.post( | |
88 | API_URL, content_type='application/json', params=params, status=status, |
|
88 | API_URL, content_type='application/json', params=params, status=status, | |
89 | headers=[('Content-Type', 'application/json')]) |
|
89 | headers=[('Content-Type', 'application/json')]) | |
|
90 | if assert_no_error: | |||
|
91 | err_resp = response.json.get('error') | |||
|
92 | if err_resp: | |||
|
93 | raise AssertionError(f'ERROR in response: {err_resp}') | |||
90 | return response |
|
94 | return response | |
91 |
|
95 | |||
92 |
|
96 |
@@ -62,7 +62,7 b' def safe_float(val, default=None) -> flo' | |||||
62 | return val |
|
62 | return val | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | def base64_to_str(text) -> str: |
|
65 | def base64_to_str(text: str | bytes) -> str: | |
66 | return safe_str(base64.encodebytes(safe_bytes(text))).strip() |
|
66 | return safe_str(base64.encodebytes(safe_bytes(text))).strip() | |
67 |
|
67 | |||
68 |
|
68 |
General Comments 0
You need to be logged in to leave comments.
Login now