kscottz / PythonFromSpace

Python Examples for Remote Sensing
BSD 3-Clause "New" or "Revised" License
451 stars 140 forks source link

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

Closed modulitos closed 7 months ago

modulitos commented 7 years ago

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.

sahil210695 commented 7 years ago

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

modulitos commented 7 years ago

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()
kscottz commented 7 years ago

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

kscottz commented 7 years ago

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

kscottz commented 7 years ago

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

danabauer commented 7 years ago

@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.