planetlabs / planet-client-python

Python client for Planet APIs
https://planet-sdk-for-python-v2.readthedocs.io/en/latest/
Apache License 2.0
276 stars 92 forks source link

Add planet.sync Namespace #1078

Open asonnenschein opened 4 days ago

asonnenschein commented 4 days ago

This PR is branched off of https://github.com/planetlabs/planet-client-python/pull/1049. It takes the new sync DataAPI, Subscriptions API, and OrdersAPI clients, and Planet wrapper class, and puts them in a new planet.sync namespace. The original async clients still live in their original namespace to support backwards compatibility. While I am open to the idea of adding an additional namespace, planet.async for the async clients, I did not include that in this PR because we need to support backwards compatibility for the existing async client patterns and adding planet.async would then be a third namespace which adds more complexity through maintenance overhead.

Examples:

# Using the synchronous Planet wrapper class
from planet.sync import Planet

pl = Planet()
pl.subscriptions.get_subscription()

# Using a sync client directly
from planet.http import Session
from planet.sync import SubscriptionsAPI

client = SubscriptionsAPI(Session())
client.get_subscription()