Skip to content

Instantly share code, notes, and snippets.

@parulnith
Created November 23, 2018 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parulnith/1025d704f474f14e1ea6da7cc256884a to your computer and use it in GitHub Desktop.
Save parulnith/1025d704f474f14e1ea6da7cc256884a to your computer and use it in GitHub Desktop.
import os
import json
import requests
from requests.auth import HTTPBasicAuth
# API Key stored as an env variable
PLANET_API_KEY = os.getenv('PL_API_KEY') # replace PL_API_KEY with Planet API key in quotes
item_type = "PSScene4Band"
# API request object
search_request = {
"interval": "day",
"item_types": [item_type],
"filter": combined_filter
}
# fire off the POST request
search_result = \
requests.post(
'https://api.planet.com/data/v1/quick-search',
auth=HTTPBasicAuth(PLANET_API_KEY, ''),
json=search_request)
print(json.dumps(search_result.json(), indent=1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment