samapriya / Planet-GEE-Pipeline-CLI

Planet and Google Earth Engine Pipeline Command Line Interface Tool
https://pypi.org/project/ppipe/
Apache License 2.0
42 stars 12 forks source link

Tool does not work on Google Colab #4

Closed guy1ziv2 closed 6 years ago

guy1ziv2 commented 6 years ago

Hi Sam - thanks for making this tool! I am trying to use it on a Google Colab and I get an error

%%bash export PL_API_KEY=I-have-my-key-here cd Planet-GEE-Pipeline-CLI/ppipe python ppipe.py -h

Traceback (most recent call last): File "ppipe.py", line 20, in from idlst import idl File "/content/Planet-GEE-Pipeline-CLI/ppipe/idlst.py", line 14, in PL_API_KEY = read_planet_json()['key'] KeyError: 'key'

I think the error originate in line 14 of idlst.py . I don't have the key as a .planet.json on the (temporary) VM. I am not sure why you don't use find_api_key() from planet.api.auth instead, which will check for PL_API_KEY first, and if not found try open the same json file ?

Cheers Guy

guy1ziv2 commented 6 years ago

p.s. I managed to get ppipe.py -h to work when I added this code -

from planet.api.utils import write_planet_json write_planet_json({'key': 'my-key-here'})

and I tested that using find_api_key() would have worked...

samapriya commented 6 years ago

I have created a quiet authentication method and now used the find_api_key() method suggested. Please note the improvements have been added to ppipe 0.3.0 which you can get from pypi

ppipe planetkey --type "quiet" --key "YOUR KEY HERE"