-
Notifications
You must be signed in to change notification settings - Fork 96
v2: add cli for orders api #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ation is provided
…eate orders returns order json, clean up tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor fix request re: planet.geojson -- otherwise this LGTM! And it works on my box, too :-D
Really great work @jreiberkyle I am SO EXCITED to see this happening!
planet/geojson.py
Outdated
raise GeoJSONException('Invalid GeoJSON: {data}') | ||
|
||
if len(features) > 1: | ||
LOGGER.warning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to raise DataLossWarning here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for bringing this up and for our offline discussion. I'll raise an exception when multiple features are given.
|
||
class DataLossWarning(UserWarning): | ||
"""Warn that data will be lost.""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency add the pass
no-op here too
geom_geojson['coordinates'] = [] | ||
_ = geojson.validate_geom(geom_geojson) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's test_validate_geom_multiple_features (or whatever) here too :)
…multiple features
thank you so much @sarasafavi for the in-depth review. changes made, merging now. YASSS!! |
This PR adds a CLI as a thin wrapper around the python api orders client. Functionality was added to the orders client and other modules to support back-compatible CLI functionality while keeping the CLI thin.
One addition to the API is implemented:
Simple management of geojson, via the new
planet/geojson.py
moduleTwo changes to the python API are implemented:
OrdersClient.create_order()
now returns the entire order description (as returned by the API) instead of just the id.This aligns with the rule of "make the client as similar to the REST API as possible" and allows the cli to easily report the details as a json blob that can be processed or viewed via the command line.
Delivery.from_dict()
tries to create a subclass if possible.For example, if the dict describes an
AmazonS3Delivery
, it makes an instance of that class. This is necessary because aDelivery
only holds the minimum delivery information while a subclass holds more information about the specific cloud. This change allows the cli to just callDelivery.from_dict()
while parsing a file and have the proper information passed intoOrdersClient.create_order()
.Other than that, the API changes are improved error handling.
Wish list: The cli.py module got huge quick. I would like to break it up into different modules based on api (e.g.
auth
andorders
). Ticket #288Closes #244
Closes #252