MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / save_apod

Function save_apod

web_programming/nasa_data.py:20–29  ·  view source on GitHub ↗
(api_key: str, path: str = ".")

Source from the content-addressed store, hash-verified

18
19
20def save_apod(api_key: str, path: str = ".") -> dict:
21 apod_data = get_apod_data(api_key)
22 img_url = apod_data["url"]
23 img_name = img_url.split("/")[-1]
24 response = httpx.get(img_url, timeout=10)
25
26 with open(f"{path}/{img_name}", "wb+") as img_file:
27 img_file.write(response.content)
28 del response
29 return apod_data
30
31
32def get_archive_data(query: str) -> dict:

Callers 1

nasa_data.pyFile · 0.85

Calls 3

get_apod_dataFunction · 0.85
splitMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected