This Python script is designed to manage Kaltura App Tokens. It allows for the creation, listing, updating, and deletion of app tokens. This document provides usage, maintenance, and extension guidelines.
- Create App Tokens: Generate new app tokens with specified privileges.
- List App Tokens: Retrieve and display all app tokens for the configured partner ID.
- Update App Tokens: Modify existing app tokens' privileges and descriptions.
- Delete App Tokens: Remove app tokens by ID.
- Session Management: Start a session with an app token after creation or update.
To run this script, you'll need Python 3 installed on your system and the KalturaClient
library.
Before running the script, you must have a config.json
file in the same directory as the script.
Clone config.template.json
to config.json
, and configure it:
<your_partner_id>
- The Partner ID from KMC Integration Settings<your_admin_secret_from_kmc>
- The Admin Secret from KMC Integration Settings
Run the following:
chmod +x kaltura_app_token_manager.py
Run the script with -h or --help to see the available options:
./kaltura_app_token_manager.py --help
./kaltura_app_token_manager.py --create --description "My App Token" --edit "*"
./kaltura_app_token_manager.py --list
./kaltura_app_token_manager.py --update "token_id" --description "Updated Description"
./kaltura_app_token_manager.py --delete "token_id"
./kaltura_app_token_manager.py --create --start_session --description "Session Token" --sview "*"
To extend the functionality:
- Add New Privileges: Introduce new privileges by expanding the PRIVILEGE_HANDLERS dictionary and updating the argument parser in setup_parser().
- Enhance Session Management: You might want to add features such as logging out sessions or extending session lifetimes.
- Improve Output Formatting: For better readability when listing tokens, consider implementing tabular display or exporting to formats like CSV.
- Integrate with Other Systems: You can extend the script to work with other systems by adding appropriate APIs and configuration options.
- Configuration Errors: Ensure config.json is valid JSON and contains the correct information.
- Dependency Issues: If the KalturaClient cannot be imported, check your Python environment and the library installation.
- API Limitations: Be aware of any API rate limits or changes in the Kaltura API that may affect the script's operation.
This script is released under the MIT License.
This script is provided "as-is" without warranty or support. Use it at your own risk. If you encounter any issues, please report them in the repository's issues section.