forked from ZeevG/python-forecast.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
37 lines (25 loc) · 846 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import datetime
import forecastio
def main():
"""
Run load_forecast() with the given lat, lng, and time arguments.
"""
api_key = "YOUR API KEY"
lat = -31.967819
lng = 115.87718
time = datetime.datetime(2015, 2, 27, 6, 0, 0)
forecast = forecastio.load_forecast(api_key, lat, lng, time=time)
print "===========Currently Data========="
print forecast.currently()
print "===========Hourly Data========="
by_hour = forecast.hourly()
print "Hourly Summary: %s" % (by_hour.summary)
for hourly_data_point in by_hour.data:
print hourly_data_point
print "===========Daily Data========="
by_day = forecast.daily()
print "Daily Summary: %s" % (by_day.summary)
for daily_data_point in by_day.data:
print daily_data_point
if __name__ == "__main__":
main()