diff options
author | 2020-03-11 16:30:04 +0200 | |
---|---|---|
committer | 2020-03-11 16:30:04 +0200 | |
commit | 6e7e8734436e73a2f8a25b2b19b62742a036a2b8 (patch) | |
tree | 0b29a646f4092023abeba072f4cff68e6037bd96 | |
parent | (Space Cog): Removed unnecessary sentence from `.mars` command docstring (diff) |
(Space Cog): Add base URL parameter to helper function `fetch_from_nasa`
-rw-r--r-- | bot/seasons/evergreen/space.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/seasons/evergreen/space.py b/bot/seasons/evergreen/space.py index 5bfae470..f4faeb48 100644 --- a/bot/seasons/evergreen/space.py +++ b/bot/seasons/evergreen/space.py @@ -188,10 +188,11 @@ class Space(Cog): await ctx.send(embed=embed) - async def fetch_from_nasa(self, endpoint: str, params: Dict[str, Any]) -> Dict[str, Any]: + async def fetch_from_nasa(self, endpoint: str, params: Dict[str, Any], base: Optional[str] = NASA_BASE_URL + ) -> Dict[str, Any]: """Fetch information from NASA API, return result.""" # Generate request URL from base URL, endpoint and parsed params - async with self.http_session.get(url=f"{NASA_BASE_URL}/{endpoint}?{urlencode(params)}") as resp: + async with self.http_session.get(url=f"{base}/{endpoint}?{urlencode(params)}") as resp: return await resp.json() |