planet-client-python icon indicating copy to clipboard operation
planet-client-python copied to clipboard

data client and cli: get variable information from the spec

Open jreiberkyle opened this issue 2 years ago • 1 comments

Right now the Data Client has hardcoded many variables (such as search sort order). This will break with API changes and will be hard to update. Change it over to obtaining the information directly from the spec e.g. one could get the search sort order valid and default entries like so:

>>> spec = json.load(open('data_spec_2022_06_29.json'))
>>> spec['parameters']['qSearchResultSort']['enum']
['acquired asc', 'acquired desc', 'published asc', 'published desc']
>>> spec['parameters']['qSearchResultSort']['default']
'published desc'

the spec can be downloaded directly from the api endpoint: https://api.planet.com/data/v1/spec

jreiberkyle avatar Jun 29 '22 21:06 jreiberkyle

Possible duplicate https://github.com/planetlabs/planet-client-python/issues/663.

asonnenschein avatar Aug 08 '24 19:08 asonnenschein