Skip to content

Commit 6d9a660

Browse files
committed
Re-write get_capabilities to use harmony-py
1 parent 77ad92c commit 6d9a660

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

icepyx/core/harmony.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from typing import Any
22

3-
import requests
4-
5-
from icepyx.core.urls import CAPABILITIES_BASE_URL
3+
import harmony
64

75

86
def get_capabilities(concept_id: str) -> dict[str, Any]:
9-
response = requests.get(
10-
CAPABILITIES_BASE_URL,
11-
params={"collectionId": concept_id},
12-
)
13-
return response.json()
7+
capabilities_request = harmony.CapabilitiesRequest(concept_id=concept_id)
8+
# TODO: This will work if the user has a .netrc file available but the other
9+
# auth options might fail. We might need to add harmony client auth to the
10+
# icepyx auth package.
11+
harmony_client = harmony.Client()
12+
response = harmony_client.submit(capabilities_request)
13+
14+
return response

0 commit comments

Comments
 (0)