Trigger an export for a specific platform. Raises: ConnectionError: If connection to desktop app fails ValueError: If platform is not connected or export fails
(self, platform_id: str)
| 43 | raise ConnectionError(f"Failed to get most recent run: {str(e)}") from e |
| 44 | |
| 45 | def export(self, platform_id: str) -> dict: |
| 46 | """Trigger an export for a specific platform. |
| 47 | |
| 48 | Raises: |
| 49 | ConnectionError: If connection to desktop app fails |
| 50 | ValueError: If platform is not connected or export fails |
| 51 | """ |
| 52 | try: |
| 53 | response = self.session.post(f"{self.base_url}/export", json={"platformId": platform_id}) |
| 54 | response.raise_for_status() |
| 55 | data = response.json() |
| 56 | |
| 57 | if not data.get('success'): |
| 58 | raise ValueError(data.get('error', 'Export failed')) |
| 59 | |
| 60 | return data |
| 61 | except requests.exceptions.RequestException as e: |
| 62 | raise ConnectionError(f"Failed to trigger export: {str(e)}") from e |
| 63 | |
| 64 | def __del__(self): |
| 65 | """Cleanup the session when the client is destroyed.""" |