This Python script utilizes NASA's Astronomy Picture of the Day (APOD) API to fetch and save the daily celestial image. The script requires the requests
library for API calls and the PIL
(Pillow) library to handle and save images.
Before running the script, make sure you have the required libraries installed. You can install them using the following:
pip install requests Pillow
To access NASA's APOD API, you need to obtain an API key. For testing purposes, a demo key is provided in the script (DEMO_KEY
). For production or frequent use, it's recommended to get your own key from the NASA API website.
- Clone the repository or download the script.
- Replace the
apiKey
variable with your NASA API key. - Run the script.
python script_name.py
The script will print a message indicating that it is running, and then it will fetch the information of the Picture of the Day from NASA's API. Subsequently, it will download and save the image as "Picture_Of_The_Day.png" in the script's directory.
Note: In case of any errors during the process, an error message will be displayed.