Skip to content

Add api root cli params#283

Merged
eric-eclecticiq merged 7 commits into
masterfrom
add-api-root-cli-params
Nov 12, 2025
Merged

Add api root cli params#283
eric-eclecticiq merged 7 commits into
masterfrom
add-api-root-cli-params

Conversation

@eric-eclecticiq
Copy link
Copy Markdown
Contributor

@eric-eclecticiq eric-eclecticiq commented Nov 10, 2025

Add --public and --id params to the CLI opentaxii-add-api-root.

Example: opentaxii-add-api-root -t Title --public --id 7468eafb-585d-402e-b6b9-49fe76492f9e

Motivation:

  • Public: No need to provide auth
  • Id: Provide an ID manually to also reuse it later in a script to add collections

@eric-eclecticiq eric-eclecticiq requested a review from saaj November 11, 2025 09:22
@eric-eclecticiq eric-eclecticiq self-assigned this Nov 11, 2025
args = parser.parse_args()

if args.id is not None:
uuid.UUID(args.id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can do the following, if you want to keep validation/type conversion to argparse. Note that the parse would return actual UUID, so you'd need to covert it back if the underlying API expects a UUID string.

    parser.add_argument(
        "-i",
        "--id",
        type=uuid.UUID,
        required=False,
        help="The UUID to assign else a UUID4 is generated",
    )

Comment thread opentaxii/persistence/sqldb/api.py Outdated
@eric-eclecticiq eric-eclecticiq merged commit 4a99f48 into master Nov 12, 2025
7 checks passed
@eric-eclecticiq eric-eclecticiq deleted the add-api-root-cli-params branch November 12, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants