planet-client-python
planet-client-python copied to clipboard
Analytics API
This PR provides a complete, production-ready Analytics 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/1189
Key Features
Analytics Feeds:
- List available feeds
- Get feed details
- Get feed statistics with temporal filtering
Analytics Subscriptions:
- List subscriptions (with optional feed filtering)
- Get subscription details
Analytics Results:
- Search results with extensive filtering:
- Feed ID and subscription ID filtering
- Temporal filtering (start/end time)
- Spatial filtering (bounding box and geometry)
- Pagination support
- Get individual result details
- Download results in multiple formats
CLI Interface:
- planet analytics feeds list/get/stats
- planet analytics subscriptions list/get
- planet analytics results search/get/download
- All commands support proper options and error handling
Details
- Async Analytics Client (planet/clients/analytics.py)
- Full feature parity with Analytics API endpoints
- Supports listing feeds, getting feed details, managing subscriptions
- Search and retrieve analytics results with filtering options
- Download results in multiple formats (JSON, GeoJSON, CSV)
- Get feed statistics
- Sync Analytics Client (planet/sync/analytics.py)
- Synchronous wrapper around the async client
- Same API surface as async client but blocking
- Integrated with the main Planet sync client
- CLI Implementation (planet/cli/analytics.py)
- Complete CLI interface using the async client
- Commands for feeds, subscriptions, and results
- Support for all filtering and download options
- Proper error handling and input validation
Integration
- Added Analytics client to main client exports
- Integrated with sync Planet client
- Added Analytics CLI commands to main CLI
Testing
- Comprehensive unit tests for async client (16 tests)
- Unit tests for sync client (15 tests)
- Unit tests for CLI commands
- Integration tests for both async and sync clients
- Integration tests for CLI commands