-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForecast.py
More file actions
20 lines (16 loc) · 735 Bytes
/
Forecast.py
File metadata and controls
20 lines (16 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import requests
class OpenWeatherMapForecasts:
def __init__(self):
print("2. Initialize the new instance of Point.")
from app import app
self.token = app.config['OWM_KEY']
def get_current_by_lat_lon(self,lat,lon):
url = "https://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&appid=" + self.token \
+ "&units=metric"
response = requests.get(url)
return response.json()
def get_forecast_by_lat_lon(self, lat, lon):
url = "https://api.openweathermap.org/data/2.5/forecast?lat=" + lat + "&lon=" + lon + "&appid=" + self.token \
+ "&units=metric"
response = requests.get(url)
return response.json()