File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11.vercel
2+ .env
3+ .env. *
Original file line number Diff line number Diff line change 11import requests
2+ import os
23
34# NASA API Key
4- nasa_api_key = wVnaajaqfHQIaOhSyc5SQWFecweOwKAe54OUSuZT
5+ nasa_api_key = os . getenv ( "NASA_API_KEY" , "DEMO_KEY" )
56
67# Construct the GET request URL
78nasa_url = f"https://api.nasa.gov/planetary/apod?api_key={ nasa_api_key } "
Original file line number Diff line number Diff line change 11import requests
22import re
3+ import os
34from typing import Optional
45
56# Parameters for the request
67params = {
7- "api_key" : "wVnaajaqfHQIaOhSyc5SQWFecweOwKAe54OUSuZT" , # Replace with your own key from https://api.nasa.gov
8+ # Use env var if provided; DEMO_KEY avoids hardcoding secrets in source.
9+ "api_key" : os .getenv ("NASA_API_KEY" , "DEMO_KEY" ),
810 "hd" : True # Optional: True to get HD image URL
911}
1012
You can’t perform that action at this time.
0 commit comments