Skip to content

Commit 6e1f301

Browse files
andrewalexanderAndrew AlexanderharningtAndrew Alexander
authored
fix: error on illegal page size (#662)
* fix: error on illegal page size * `poetry black` Co-authored-by: Thomas Harning Jr <thomas@censys.io> * move arg checking before saved query * flake8 * chore(deps) poetry update and dev dependency update * fix(tests) add tests for page size handling * chore(black) fix trailing comma --------- Co-authored-by: Andrew Alexander <andrewalexander@censys.io> Co-authored-by: Thomas Harning Jr <thomas@censys.io> Co-authored-by: Andrew Alexander <andrewalexander@censys.com>
1 parent 8f95e6c commit 6e1f301

File tree

5 files changed

+550
-341
lines changed

5 files changed

+550
-341
lines changed

censys/cli/commands/asm.py

+14
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,13 @@ def cli_execute_saved_query_by_name(args: argparse.Namespace):
547547
Args:
548548
args (Namespace): Argparse Namespace.
549549
"""
550+
# do some sanity checking on page size before anything else
551+
if args.page_size > 1000:
552+
console.print(
553+
"page size must be within [0,1000]. To fetch all pages, specify --pages -1 with any legal page size"
554+
)
555+
556+
sys.exit(1)
550557
s = InventorySearch(args.api_key)
551558
q = SavedQueries(args.api_key)
552559
# get query from name
@@ -573,6 +580,13 @@ def cli_execute_saved_query_by_id(args: argparse.Namespace):
573580
Args:
574581
args (Namespace): Argparse Namespace.
575582
"""
583+
# do some sanity checking on page size before anything else
584+
if args.page_size > 1000:
585+
console.print(
586+
"page size must be within [0,1000]. To fetch all pages, specify --pages -1 with any legal page size"
587+
)
588+
589+
sys.exit(1)
576590
s = InventorySearch(args.api_key)
577591
q = SavedQueries(args.api_key)
578592
try:

docs/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sphinx==7.2.6
22
sphinxcontrib-autoprogram==0.1.9
3-
sphinx-rtd-theme==1.3.0
3+
sphinx-rtd-theme==3.0.2
44
sphinx-prompt==1.8.0
55
sphinx-tabs==3.4.1
66
sphinx-copybutton==0.5.2

0 commit comments

Comments
 (0)