Complete Jython-compatible wrapper for TOSCA Commander REST API with pluggable HTTP clients.
from tosca_commander_api_v2 import connect
# Connect and open workspace
session = connect(
"http://localhost:1111/rest/toscacommander",
workspace_name="MyWorkspace",
token="your-token"
)
# Use the API
result = session.get_object("object-id")
result = session.create_object("parent-id", {"TypeName": "Folder", "Name": "New Folder"})- ✅ Full REST API Support - All TOSCA Commander REST API endpoints
- ✅ Multiple HTTP Clients - Jython, urllib (built-in), requests
- ✅ Python 2/3/Jython Compatible - Works everywhere
- ✅ Pluggable Architecture - Easy to add custom HTTP implementations
- ✅ Comprehensive Logging - Debug, Info, Warning, Error levels
- ✅ 3 Authentication Methods - PAT, Client Credentials, Basic Auth
# Copy files to your project
cp tosca_commander_api_v2.py /your/project/
cp http_client.py /your/project/
# Or use the original (still works)
cp tosca_commander_api.py /your/project/📚 Full documentation in docs/ directory:
- QUICKSTART.md - 5-minute quick start guide
- WPROWADZENIE.md - Introduction (Polish)
- API_REFERENCE.md - Complete API reference
- HTTP_CLIENTS.md - HTTP client implementations
- ARCHITECTURE.md - Architecture overview
- BEST_PRACTICES.md - Best practices guide
- COMPATIBILITY.md - Python 2/3/Jython compatibility
- CHANGELOG.md - Version history
- PROJECT_SUMMARY.md - Project summary (PL/EN)
- FILES_OVERVIEW.md - All project files
# Auto-detection (default) - tries Jython → requests → urllib
api = ToscaCommanderAPI(url, http_client_type='auto')
# urllib (built-in, works everywhere - Python 2/3/Jython)
api = ToscaCommanderAPI(url, http_client_type='urllib')
# requests (faster, better features: pip install requests)
api = ToscaCommanderAPI(url, http_client_type='requests')
# Jython/Java (best for java based environments)
api = ToscaCommanderAPI(url, http_client_type='jython')from tosca_commander_api_v2 import ToscaCommanderAPI
api = ToscaCommanderAPI("http://localhost:1111/rest/toscacommander")
api.set_personal_access_token("your-token")
# Get workspaces
result = api.get_workspaces()
# Open workspace
result = api.open_workspace("MyWorkspace")# Create folder
folder = {
"TypeName": "Folder",
"Name": "API Test",
"Properties": {"Description": "Created via API"}
}
result = session.create_object("parent-id", folder)
# Update object
result = session.update_object("object-id", {
"Properties": {"Description": "Updated"}
})
# Execute task
result = session.execute_task("object-id", "TaskName", {})# Test structure (Python 3)
python3 test_structure.py
# Test compatibility
python3 test_compatibility.py
# Test HTTP clients
python3 test_http_clients.py
# Full tests (requires Jython)
jython test_api.py| Feature | Python 2.7 | Python 3.x | Jython 2.7+ |
|---|---|---|---|
| Import & Config | ✅ | ✅ | ✅ |
| urllib HTTP | ✅ | ✅ | ✅ |
| requests HTTP | ✅ | ✅ | ❌ |
| Jython HTTP | ❌ | ❌ | ✅ |
| Logging | ✅ | ✅ | ✅ |
api.set_personal_access_token("your-token")api.set_client_credentials("client-id", "client-secret")api.set_basic_auth("username", "password")tosca-commander-api/
├── tosca_commander_api.py # Original API (v1.1)
├── tosca_commander_api_v2.py # Refactored API (v2.0)
├── http_client.py # HTTP abstraction layer
├── example_usage.py # Basic examples
├── example_advanced.py # Advanced examples
├── config.example.py # Configuration template
├── test_*.py # Test suites
├── docs/ # 📚 Documentation
│ ├── *.md # All documentation files
│ └── tricentis_api_docs/ # Tricentis HTML docs (gitignored)
└── README.md # This file
# Copy config template
cp config.example.py config.py
# Edit with your credentials
nano config.pyImportant: Never commit config.py - it's already in .gitignore
Minimal (works out of the box):
- Python 2.7+ or Python 3.x or Jython 2.7+
- No external dependencies required (uses built-in urllib)
Optional (for better performance):
requestslibrary:pip install requests
For Jython integration:
- Jython 2.7+ with Java libraries
Current: v2.0.0 (with HTTP client abstraction)
- v2.0.0 - HTTP client abstraction layer
- v1.1.0 - Python 2/3/Jython compatibility
- v1.0.0 - Initial release
See CHANGELOG.md for full history.
WTFPL - Do What The Fuck You Want To Public License
See LICENSE file for details.
- 📖 Documentation: docs/
- 🐛 Issues: Check BEST_PRACTICES.md
- 💡 Examples: See
example_usage.pyandexample_advanced.py
Based on TOSCA Commander REST API Documentation v2024.2
Ready to use! 🚀 Start with docs/QUICKSTART.md