PythonFromSpace icon indicating copy to clipboard operation
PythonFromSpace copied to clipboard

Unable to get results for ` client.get_assets_by_id('PSScene3Band', <scene_id>)`

Open modulitos opened this issue 8 years ago • 6 comments

First, thank you for the amazing talk at PyCon :-D

I signed up for a Planet api key by creating an account here: https://www.planet.com/account/ and I am following your demo, but I am blocked when we make a call to client.get_assets_by_id('PSScene3Band', <scene_id>) (in the call to get_products on In [31] of your TheBasics.ipynb notebook).

client.get_assets_by_id returns an empty object. It appears to make an HTTP GET to https://api.planet.com/data/v1/item-types/PSScene3Band/items/<scene_id>/assets/, so I explored that endpoint a bit, and it seems to be an access issue.

For example, here is my call (api_key omitted for security): https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/assets/?api_key=<api_key> but here is my response:

{"message": "Please enter your API key.", "errors": []}

Any suggestions about how to get a response here would be great.

modulitos avatar May 23 '17 02:05 modulitos

Same error here also !!! Solution please !!!

sahil210695 avatar May 23 '17 10:05 sahil210695

FWIW, I'm getting a response when I hit this endpoint: https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044, but when I query for the assets of that item (by appending /assets to the url), I'm getting an empty object. Why don't these items have any assets?

If it helps, here is the code for the client.get_assets_by_id method:

    def get_assets_by_id(self, item_type, id):
        '''Get an item's asset response for the given item_type and id

        :param item_type str: A valid item-type
        :param id str: The id of the item
        :returns: :py:Class:`planet.api.models.JSON`
        :raises planet.api.exceptions.APIException: On API error.
        '''
        url = 'data/v1/item-types/%s/items/%s/assets' % (item_type, id)
        return self._get(url).get_body()

modulitos avatar May 23 '17 19:05 modulitos

Sorry about the delay. I've been traveling. Let me pull in some support people.

kscottz avatar May 24 '17 23:05 kscottz

I notified Planet's developer advocate and the public API manager. They will take a look shortly.

kscottz avatar May 24 '17 23:05 kscottz

Also I would file a ticket over here where the client is being maintained. You might get a faster response.

kscottz avatar May 24 '17 23:05 kscottz

@LukeSwart This is likely a permissions issue. You're looking at imagery of the Seattle area that was captured just a few days ago. When you sign up for a free Planet account, you get download access to our archive of California data (with a two-week delay) under a CC BY-SA 4.0 license. We do have a program to give academic researchers free access to other geographic areas. But Open California is your best bet if you're a dev or data analyst wanting to get started with the full range of Planet's imagery.

danabauer avatar May 25 '17 07:05 danabauer