planet-client-python
planet-client-python copied to clipboard
data client and cli: get variable information from the spec
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
Possible duplicate https://github.com/planetlabs/planet-client-python/issues/663.