Downloading imagery: API key problem?


I am trying to download Planet data though the CLI or through Python scripts but unfortunately neither of them works for me. The Python script below returns an empty dataset, while I expect it to return activation URLs, and the CLI downloads no data. Is there an issue with my account/API key? Could you please help me to correct the requesting code if there is an issue with it?


import os
import requests
from planet import api
client = api.ClientV1(api_key)

planet_field = {"type": "Polygon", "coordinates": [[[38.792725, -1.839894], [38.17749, -1.592812], [38.133545, -2.580914], [38.71582, -2.580914], [38.792725, -1.839894]]]}
query = api.filters.and_filter(api.filters.geom_filter(planet_field))
item_type = 'PSScene4Band'
asset_type = 'analytic'
request = api.filters.build_search_request(query, [item_type])
results = client.quick_search(request)

for item in results.items_iter(10):
# each item is a GeoJSON feature
print (item['id'])

session = requests.Session()
session.auth = (api_key, '')
dataset = session.get(("{}/items/{}/assets/").format(item_type[0], item['id']))
item_activation_url = dataset.json()[asset_type]["_links"]["activate"]

for item in results.items_iter(5):
assets = client.get_assets(item).get()
activation = client.activate(assets['analytic'])
# wait for it
assets = client.get_assets(item).get()
callback = api.write_to_file(directory='\here\goes\my\directory', callback= None, overwrite= True)
body =['analytic'], callback=callback)


planet --api-key XXX data download --item-type 'PSScene3Band' --asset-type 'analytic' --date acquired gt '2021-04-20' --date acquired lt '2021-04-26' --geom aoi.json --dest planet




1 comment
  • Hello,


    I've created a support ticket for this. Let me investigate and get back to you.


Please sign in to leave a comment.

Didn't find what you were looking for?

New post