Add get-token command for generating JWTs with custom expiry #202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
This PR introduces new
limacharlie get-token --hours=<expiry time in hours>command which allows users to generateJWTs with longer expiration time.
Use cases include operations which require longer expiration tokens (e.g. search results download).
Keep in mind that this feature is implemented as a low level utility command. In the future when
search results downloadcommand is implemented, generating long lived token for the purpose of the download will be handled transparently by the new command.
Background
Long-running operations like search download jobs can run for several hours. The default JWT tokens expire after ~1 hour, which causes these jobs to fail mid-execution. This PR enables users to generate tokens with sufficient validity for their expected job duration.
Changes
SDK Changes (
limacharlie/Manager.py)getJWT(expiry_seconds)public method that:CLI Changes (
limacharlie/__main__.py)get-tokencommand with options:--hours: Token validity duration (default: 1 hour)--format: Output format -raw(just token) orjson(with metadata)--environment: Specify which configured environment to useUsage Examples