Get the most recent run for a specific platform. Raises: ConnectionError: If connection to desktop app fails ValueError: If no successful runs are found for the platform
(self, platform_id: str)
| 16 | |
| 17 | |
| 18 | def get(self, platform_id: str) -> dict: |
| 19 | """Get the most recent run for a specific platform. |
| 20 | |
| 21 | Raises: |
| 22 | ConnectionError: If connection to desktop app fails |
| 23 | ValueError: If no successful runs are found for the platform |
| 24 | """ |
| 25 | try: |
| 26 | response = self.session.post(f"{self.base_url}/get", json={"platformId": platform_id}) |
| 27 | |
| 28 | # Handle 404 status codes specifically |
| 29 | if response.status_code == 404: |
| 30 | error_data = response.json() |
| 31 | raise ValueError(error_data['error']) |
| 32 | |
| 33 | # Handle other HTTP errors |
| 34 | response.raise_for_status() |
| 35 | |
| 36 | data = response.json() |
| 37 | if not data.get('success'): |
| 38 | raise ValueError(data.get('error', 'Unknown error occurred')) |
| 39 | |
| 40 | return data |
| 41 | |
| 42 | except requests.exceptions.RequestException as e: |
| 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. |
no outgoing calls
no test coverage detected