planet-client-python
planet-client-python copied to clipboard
Reports API
This PR provides a complete, production-ready Reports API client that seamlessly integrates with the existing Planet Python SDK architecture and follows all established patterns and conventions. Generated with help from Claude Code:
Ticket
https://github.com/planetlabs/planet-client-python/issues/1190
Key Features
- API Endpoints: List reports, get report details, create/delete reports, download report content, check status, list types/formats
- Error Handling: Proper APIError and ClientError propagation
- Authentication: Uses existing Planet SDK authentication system
- Consistent Patterns: Follows exact same patterns as other Planet API clients
- Type Hints: Full type annotations throughout
- Documentation: Comprehensive docstrings for all methods
- CLI Features: JSON config files, output redirection, pretty-printing, help text
Details
- Async Client SDK (planet/clients/reports.py)
- ReportsClient class extending _BaseClient
- Methods: list_reports, get_report, create_report, download_report, get_report_status, delete_report, list_report_types, get_report_export_formats
- Full async/await support following existing patterns
- Sync Client SDK (planet/sync/reports.py)
- ReportsAPI class wrapping the async client
- Same method signatures with synchronous execution
- Integrated into Planet class as planet.reports
- CLI Implementation (planet/cli/reports.py)
- Complete CLI commands: list, get, create, download, status, delete, types, formats
- Integrated into main CLI as planet reports
- Support for JSON config files, output redirection, and formatting options
- Comprehensive Test Suite
- Unit tests for async client (13 tests)
- Unit tests for sync client (8 tests)
- Unit tests for CLI (14 tests)
- Integration tests for both sync/async clients and CLI
- Package Integration
- Added to planet.clients.init.py exports and client directory
- Integrated into planet.sync.client.Planet class
- Added to main CLI command registration
Code Quality
- Passes linting (flake8, yapf)
- Follows PEP8 style guidelines
- Matches existing codebase patterns
- Proper error handling and type safety
- Integration tests verify functionality