$ show planetlabs/planet-client-python
The Planet Labs Python SDK provides both a programmatic interface and a command-line tool for interacting with Planet's satellite imagery and data APIs. It enables users to authenticate, search for imagery, create and manage orders, handle subscriptions, upload areas of interest, configure cloud storage destinations, and access mosaics. The SDK is designed with a clear separation of concerns, featuring asynchronous API clients with synchronous wrappers, a robust HTTP session with retry and rate-limiting logic, and a flexible authentication system supporting multiple methods (API key, OAuth user, OAuth M2M) and storage strategies. Key architectural elements include a base client class that handles common HTTP operations, service-specific clients for each Planet API, and a Click-based CLI that mirrors the SDK's functionality. The repository also includes reusable utilities for GeoJSON handling, search filter construction, order and subscription request building, and progress reporting for long-running operations. The codebase demonstrates strong engineering practices with extensive test coverage, clear documentation, and active maintenance.
The LLM identified 5 files worth highlighting for reuse:
Implements a Session class that manages HTTP requests with exponential backoff, rate limiting, and worker throttling. Provides both synchronous and asynchronous interfaces, handles authentication, and centralizes request/response processing. This reusable component could be extracted for use with other APIs due to its self-contained design and non-obvious skill in handling concurrency and error resilience.
Provides a flexible authentication system supporting API keys, OAuth user/authcode, OAuth M2M, and legacy methods. Includes factory methods (Auth.from_*) and supports various storage strategies (in-memory, disk, custom). Demonstrates non-obvious skill in abstracting complex auth flows while maintaining extensibility, making it reusable in other applications requiring multiple auth mechanisms.
Offers StateBar and AssetStatusBar classes for tracking long-running operations (order processing, asset downloads) using tqdm. Provides clean, reusable progress reporting with automatic state transitions and error handling. This component is self-contained and could be extracted for any CLI or application needing to monitor asynchronous tasks.
Handles conversion between GeoJSON, feature references (pl:features/...), and geometries. Includes validation, conversion utilities, and error handling for GeoJSON data. This module is isolated, demonstrates careful handling of spatial data formats, and could be reused in any geospatial application requiring robust GeoJSON processing.
Provides composable functions for building structured search filters (date_range, geometry, permission, etc.) for the Planet Data API. Implements a clean, reusable pattern for constructing complex filter objects through function composition. This utility is self-contained, reduces boilerplate in search operations, and could be adapted for other APIs requiring similar filter construction.