Skip to content

Commit da79ff0

Browse files
committed
api: Add function to get an object from a URL
Because the series dependencies are represented as a list of URLs, we need a way to retrieve objects by their API URL instead of the numeric ID. This adds a function which is more or less a public wrapper of the private "_get" method. Signed-off-by: Adam Hassick <ahassick@iol.unh.edu>
1 parent 58641b3 commit da79ff0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git_pw/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ def version() -> ty.Tuple[int, int]:
232232
return (1, 0)
233233

234234

235+
def get(url: str, params: ty.Optional[Filters]) -> ty.Dict:
236+
"""Get a JSON document from the API and return it as a dict."""
237+
return _get(url, params, stream=False).json()
238+
239+
235240
def download(
236241
url: str,
237242
params: ty.Optional[Filters] = None,

0 commit comments

Comments
 (0)