Skip to content

Commit 3450e3a

Browse files
committed
Support custom max_num_results
1 parent f0b6fd4 commit 3450e3a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/vws/query.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from ._authorization import authorization_header, rfc_1123_date
1313
from ._result_codes import raise_for_result_code
14+
from .exceptions import MaxNumResultsOutOfRange
1415

1516

1617
class CloudRecoService:
@@ -86,6 +87,9 @@ def query(
8687
data=content,
8788
)
8889

90+
if 'Integer out of range' in response.text:
91+
raise MaxNumResultsOutOfRange(response=response)
92+
8993
raise_for_result_code(
9094
response=response,
9195
expected_result_code='Success',

tests/test_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ def test_too_many(
166166
"Integer out of range (51) in form data part 'max_result'. "
167167
'Accepted range is from 1 to 50 (inclusive).'
168168
)
169-
assert str(exc.value) == expected_value
169+
assert str(exc.value) == exc.value.response.text == expected_value

0 commit comments

Comments
 (0)