Skip to content

Commit d3898aa

Browse files
authored
Merge pull request #172 from planetlabs/auth-fix
authenticate item & asset type calls from CLI
2 parents 2453744 + 48c1f73 commit d3898aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

planet/scripts/item_asset_types.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
from planet.api.dispatch import _get_user_agent
3+
from planet.api.auth import find_api_key
34

45
ITEM_TYPE_URL = 'https://api.planet.com/data/v1/item-types/'
56
ASSET_TYPE_URL = 'https://api.planet.com/data/v1/asset-types/'
@@ -36,7 +37,10 @@
3637

3738

3839
def _get_json_or_raise(url, timeout=0.7):
39-
headers = {'User-Agent': _get_user_agent()}
40+
api_key = find_api_key()
41+
headers = {'User-Agent': _get_user_agent(),
42+
'Authorization': 'api-key %s' % api_key
43+
}
4044
resp = requests.get(url, timeout=timeout, headers=headers)
4145
resp.raise_for_status()
4246
return resp.json()

0 commit comments

Comments
 (0)