Skip to content

Conversation

@advaith-censys
Copy link
Contributor

Problem
The censys asm search CLI command's --fields and --sort arguments were broken and could not accept any values.

Root Cause: The argparse argument definitions used type=List[str], which is invalid. Argparse's type= parameter expects a callable (like str, int, float) that converts a string to the desired type. List[str] is a type hint, not a callable, causing argparse to fail when parsing any input.

Before this PR this command would fail

censys asm search --query "type: HOST" --fields host.services.port
usage: censys asm search [-h] [--api-key API_KEY] --query QUERY [--page-size PAGE_SIZE] [--cursor CURSOR] [--sort SORT]
                         [--fields FIELDS] [--workspaces WORKSPACES] [--pages PAGES] [-v]
censys asm search: error: argument --fields: invalid List value: 'host.services.port'

How to Test

  1. Pull branch and install
cd censys-python
poetry install
  1. Configure Credentials
poetry run censys asm config
# Enter your ASM API key when prompted
  1. Try out the search command with fields filter
poetry run censys asm search --query "type: HOST" --fields host.services.port
  1. Validate output is correct.

@advaith-censys advaith-censys changed the title fix(censys/cli/asm): filter fields fix(censys/cli/asm): support filter and sorting of fields Dec 11, 2025
Copy link
Member

@thehappydinoa thehappydinoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thehappydinoa thehappydinoa merged commit 3ec978e into censys:main Dec 11, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants