Python SDK #
Update client for Python applications using the requests library.
Files #
sdk/python/dmsi_update_client.py
sdk/python/examples/desktop-app-example.py
Requirements #
- Python 3.6+
requestslibrary (pip install requests)
Basic Usage #
from dmsi_update_client import DmsiUpdateClient
client = DmsiUpdateClient(
api_url='https://yoursite.com',
product_id=42
)
# Check for update
result = client.check_update(
license_key='XXXX-XXXX-XXXX-XXXX',
current_version='1.0.0',
channel='stable'
)
if result and result.get('update_available'):
print(f"Update available: {result['version']}")
download_url = result['download_url']
Available Methods #
| Method | Description |
|---|---|
check_update(license_key, current_version, channel, environment) | Check for available update |
get_version_info(license_key, version) | Get metadata for a specific version |
list_versions(license_key, channel) | List available versions |
get_status() | Server health check |
download(url, destination, expected_hash) | Download file with optional hash verification |
Downloading an Update #
success = client.download(
url=result['download_url'],
destination='/tmp/update.zip',
expected_hash=result['file_hash'] # optional
)
if not success:
print(f"Download failed: {client.last_error}")
Desktop App Pattern #
See sdk/python/examples/desktop-app-example.py for a complete example showing:
- Background thread for update checking
- System tray notification
- Download progress reporting
- File extraction and restart
