typesdigital commited on
Commit
f7f4eea
·
1 Parent(s): acaf7d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -5,13 +5,11 @@ import sys
5
  # Replace YOUR_API_KEY_HERE with your actual API key from OpenWeatherMap
6
  api_key = "1aafc3163909c1493596da9340e00aee"
7
 
8
- # Check if a city name was provided as a command line argument
9
  if len(sys.argv) < 2:
10
- print("Please provide a city name as a command line argument.")
11
- sys.exit(1)
12
-
13
- # Get the city name from the command line arguments
14
- city_name = sys.argv[1]
15
 
16
  # Make the API call to get the current weather details
17
  url = f"https://api.openweathermap.org/data/2.5/weather?q={city_name}&appid={api_key}"
 
5
  # Replace YOUR_API_KEY_HERE with your actual API key from OpenWeatherMap
6
  api_key = "1aafc3163909c1493596da9340e00aee"
7
 
8
+ # Get the city name from the command line arguments, or use a default value
9
  if len(sys.argv) < 2:
10
+ city_name = "London"
11
+ else:
12
+ city_name = sys.argv[1]
 
 
13
 
14
  # Make the API call to get the current weather details
15
  url = f"https://api.openweathermap.org/data/2.5/weather?q={city_name}&appid={api_key}"