Sync client base_url option #1171
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR updates the
Planet()
sync client with a kwarg option to override the default base url for different client APIs. Support for configuring a custom base_url already exists for the async clients and CLI, this MR just brings that feature parity to the sync client. Even though this is a trivial change, I am including some unit tests to demonstrate that this functionality works and exists rather than updating the public docs because I think this feature holds more value for internal Planet workflows rather than customer workflows.I also noticed that the list of subscription statuses in the CLI was missing the new
invalid
status, so I added that in this MR.Notes from Claude:
I have successfully completed GitHub issue #1143 "Fix base URL handling". Here's what was implemented:
✅ CLI Support
The CLI already had --base-url options implemented for all API commands:
✅ SDK Support
Updated the synchronous Planet client in planet/sync/client.py to support configurable base URLs:
from planet import Planet
Use custom base URLs for specific APIs
pl = Planet(
data_base_url="https://staging-data.planet.com/data/v1",
orders_base_url="https://staging-orders.planet.com/compute/ops"
)
Or use defaults (production)
pl = Planet()
✅ Backward Compatibility
All changes maintain full backward compatibility - existing code continues to work without modification.
✅ Implementation Details
The implementation satisfies all acceptance criteria: