You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Import helper modules:
import os
import json
import requests
# Setup the API Key from the `PL_API_KEY` environment variable
PLANET_API_KEY = os.getenv('PL_API_KEY')
print("PLANET_API_KEY:", PLANET_API_KEY)
# Helper function to printformatted JSON using the json module
def p(data):
print(json.dumps(data, indent=2))
# Our First Request
# Setup Planet Data API base URL
# url from the example:
# URL = "https://api.planet.com/data/v1"
# url for the 'items' api returns the item in the response:
# URL = "https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044"
# TODO: why does querying for that item's asset give an empty response?
URL = "https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/assets/"
# Setup the session
session = requests.Session()
# Authenticate
session.auth = (PLANET_API_KEY, "")
# Make a GET request to the Planet Data API
res = session.get(URL)
print("res.status_code", res.status_code)
print("res.text:", res.text)
print(res.json())
p(res.json())
Perhaps this is a bug in the API, or maybe I am missing something? Any tips would be helpful.
The text was updated successfully, but these errors were encountered:
This bug is related to the bug I posted here: kscottz/PythonFromSpace#1
I am trying to gather assets for my items, but my queries for assets always return an empty object. Any suggestions on how I can gather these assets?
For example, I can look up an item with the following query: https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/ but I am getting an empty object when I try to get the assets for that item, here:
https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/assets/
Here is a more thorough example:
Perhaps this is a bug in the API, or maybe I am missing something? Any tips would be helpful.
The text was updated successfully, but these errors were encountered: