-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-write
get_capabilities
to use harmony-py
- Loading branch information
1 parent
77ad92c
commit 6d9a660
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
from typing import Any | ||
|
||
import requests | ||
|
||
from icepyx.core.urls import CAPABILITIES_BASE_URL | ||
import harmony | ||
|
||
|
||
def get_capabilities(concept_id: str) -> dict[str, Any]: | ||
response = requests.get( | ||
CAPABILITIES_BASE_URL, | ||
params={"collectionId": concept_id}, | ||
) | ||
return response.json() | ||
capabilities_request = harmony.CapabilitiesRequest(concept_id=concept_id) | ||
# TODO: This will work if the user has a .netrc file available but the other | ||
# auth options might fail. We might need to add harmony client auth to the | ||
# icepyx auth package. | ||
harmony_client = harmony.Client() | ||
response = harmony_client.submit(capabilities_request) | ||
|
||
return response |