In [1]:
import requests
In [2]:
response = requests.get("https://api.forecast.io/forecast/94bc3fa3628bfad686b10e7054c67f71/40.7141667, -74.0063889")
In [3]:
data = response.json()
Forecasts Part One: Getting data
Using the Dark Sky Forecast API at https://developer.forecast.io/, generate a sentence that describes the weather that day.
Right now it is TEMPERATURE degrees out and SUMMARY. Today will be TEMP_FEELING with a high of HIGH_TEMP and a low of LOW_TEMP. RAIN_WARNING.
TEMPERATURE is the current temperature SUMMARY is what it currently looks like (partly cloudy, etc - it's "summary" in the dictionary). Lowercase, please. TEMP_FEELING is whether it will be hot, warm, cold, or moderate. You will probably use HIGH_TEMP and your own thoughts and feelings to determine this. HIGH_TEMP is the high temperature for the day. LOW_TEMP is the low temperature for the day. RAIN_WARNING is something like "bring your umbrella!" if it is going to rain at some point during the day.
You can take a look at the documentation, but "current" contains the current conditions and the first element of "daily" is for the current day.
In [4]:
print(data)
{'latitude': 40.7141667, 'flags': {'units': 'us', 'sources': ['darksky', 'lamp', 'gfs', 'cmc', 'nam', 'rap', 'rtma', 'sref', 'fnmoc', 'isd', 'nwspa', 'madis', 'nearest-precip'], 'isd-stations': ['725033-94728', '725060-94728', '725060-99999', '997271-99999', '999999-94706'], 'lamp-stations': ['KBLM', 'KCDW', 'KEWR', 'KFRG', 'KHPN', 'KJFK', 'KLGA', 'KMMU', 'KNYC', 'KSMQ', 'KTEB'], 'darksky-stations': ['KDIX'], 'madis-stations': ['AU015', 'BATN6', 'C1099', 'C9714', 'D0486', 'D3216', 'D6004', 'D9152', 'E0405', 'E1296', 'E2876', 'KNYC', 'KTEB', 'NJ12', 'NJ65', 'ROBN4']}, 'daily': {'icon': 'rain', 'summary': 'Rain today through Saturday, with temperatures falling to 82°F on Sunday.', 'data': [{'apparentTemperatureMax': 89.87, 'humidity': 0.76, 'apparentTemperatureMin': 69.53, 'temperatureMinTime': 1467698400, 'ozone': 302.93, 'temperatureMin': 69.53, 'time': 1467691200, 'precipProbability': 0.66, 'windBearing': 259, 'moonPhase': 0.05, 'precipType': 'rain', 'dewPoint': 68.6, 'visibility': 7.73, 'precipIntensityMaxTime': 1467698400, 'icon': 'rain', 'precipIntensityMax': 0.0915, 'windSpeed': 2.12, 'cloudCover': 0.55, 'temperatureMax': 86.23, 'precipIntensity': 0.0203, 'pressure': 1008.86, 'sunriseTime': 1467711130, 'apparentTemperatureMaxTime': 1467752400, 'temperatureMaxTime': 1467752400, 'summary': 'Rain in the morning.', 'sunsetTime': 1467765086, 'apparentTemperatureMinTime': 1467698400}, {'apparentTemperatureMax': 94.71, 'humidity': 0.64, 'apparentTemperatureMin': 73.29, 'temperatureMinTime': 1467795600, 'ozone': 293.93, 'temperatureMin': 73.29, 'time': 1467777600, 'precipProbability': 0, 'windBearing': 232, 'moonPhase': 0.08, 'dewPoint': 67.9, 'visibility': 9.97, 'icon': 'partly-cloudy-day', 'precipIntensityMax': 0, 'sunriseTime': 1467797567, 'cloudCover': 0.2, 'temperatureMax': 90.15, 'precipIntensity': 0, 'pressure': 1011, 'windSpeed': 2.91, 'apparentTemperatureMaxTime': 1467835200, 'temperatureMaxTime': 1467835200, 'summary': 'Partly cloudy in the morning.', 'sunsetTime': 1467851468, 'apparentTemperatureMinTime': 1467795600}, {'apparentTemperatureMax': 97.73, 'humidity': 0.73, 'apparentTemperatureMin': 73.73, 'temperatureMinTime': 1467882000, 'ozone': 295.01, 'temperatureMin': 73.73, 'time': 1467864000, 'precipProbability': 0.7, 'windBearing': 175, 'moonPhase': 0.11, 'precipType': 'rain', 'dewPoint': 71.64, 'visibility': 10, 'precipIntensityMaxTime': 1467925200, 'icon': 'rain', 'precipIntensityMax': 0.1398, 'windSpeed': 5.13, 'cloudCover': 0.32, 'temperatureMax': 89.78, 'precipIntensity': 0.0212, 'pressure': 1009.36, 'sunriseTime': 1467884004, 'apparentTemperatureMaxTime': 1467914400, 'temperatureMaxTime': 1467914400, 'summary': 'Rain starting in the afternoon.', 'sunsetTime': 1467937849, 'apparentTemperatureMinTime': 1467882000}, {'apparentTemperatureMax': 94.16, 'humidity': 0.8, 'apparentTemperatureMin': 74.11, 'temperatureMinTime': 1467975600, 'ozone': 300.76, 'temperatureMin': 74.11, 'time': 1467950400, 'precipProbability': 0.53, 'windBearing': 167, 'moonPhase': 0.15, 'precipType': 'rain', 'dewPoint': 72.61, 'visibility': 10, 'precipIntensityMaxTime': 1467979200, 'icon': 'rain', 'precipIntensityMax': 0.0234, 'windSpeed': 3.02, 'cloudCover': 0.59, 'temperatureMax': 85.79, 'precipIntensity': 0.0086, 'pressure': 1007.17, 'sunriseTime': 1467970443, 'apparentTemperatureMaxTime': 1468011600, 'temperatureMaxTime': 1468011600, 'summary': 'Light rain in the morning and afternoon.', 'sunsetTime': 1468024228, 'apparentTemperatureMinTime': 1467975600}, {'apparentTemperatureMax': 88.78, 'humidity': 0.76, 'apparentTemperatureMin': 73.23, 'temperatureMinTime': 1468062000, 'ozone': 305.18, 'temperatureMin': 73.23, 'time': 1468036800, 'precipProbability': 0.55, 'windBearing': 242, 'moonPhase': 0.18, 'precipType': 'rain', 'dewPoint': 70.43, 'precipIntensityMaxTime': 1468054800, 'icon': 'rain', 'precipIntensityMax': 0.0279, 'windSpeed': 10.44, 'cloudCover': 0.36, 'temperatureMax': 84.85, 'precipIntensity': 0.0081, 'pressure': 1005.93, 'sunriseTime': 1468056884, 'apparentTemperatureMaxTime': 1468094400, 'temperatureMaxTime': 1468094400, 'summary': 'Light rain in the morning.', 'sunsetTime': 1468110605, 'apparentTemperatureMinTime': 1468062000}, {'apparentTemperatureMax': 83.43, 'humidity': 0.66, 'apparentTemperatureMin': 70.37, 'temperatureMinTime': 1468152000, 'ozone': 332.27, 'temperatureMin': 70.37, 'time': 1468123200, 'precipProbability': 0.02, 'windBearing': 280, 'moonPhase': 0.21, 'precipType': 'rain', 'dewPoint': 62.89, 'precipIntensityMaxTime': 1468123200, 'icon': 'wind', 'precipIntensityMax': 0.0011, 'windSpeed': 14.96, 'cloudCover': 0, 'temperatureMax': 81.82, 'precipIntensity': 0.0007, 'pressure': 1008.81, 'sunriseTime': 1468143325, 'apparentTemperatureMaxTime': 1468188000, 'temperatureMaxTime': 1468188000, 'summary': 'Breezy in the morning.', 'sunsetTime': 1468196980, 'apparentTemperatureMinTime': 1468152000}, {'apparentTemperatureMax': 84.27, 'humidity': 0.61, 'apparentTemperatureMin': 69.09, 'temperatureMinTime': 1468234800, 'ozone': 329.39, 'temperatureMin': 69.09, 'time': 1468209600, 'precipProbability': 0, 'windBearing': 286, 'moonPhase': 0.24, 'dewPoint': 61.32, 'icon': 'clear-day', 'precipIntensityMax': 0, 'sunriseTime': 1468229768, 'cloudCover': 0, 'temperatureMax': 82.81, 'precipIntensity': 0, 'pressure': 1015.03, 'windSpeed': 9.59, 'apparentTemperatureMaxTime': 1468274400, 'temperatureMaxTime': 1468274400, 'summary': 'Clear throughout the day.', 'sunsetTime': 1468283353, 'apparentTemperatureMinTime': 1468234800}, {'apparentTemperatureMax': 84.75, 'humidity': 0.56, 'apparentTemperatureMin': 69.14, 'temperatureMinTime': 1468321200, 'ozone': 311.37, 'temperatureMin': 69.14, 'time': 1468296000, 'precipProbability': 0, 'windBearing': 308, 'moonPhase': 0.27, 'dewPoint': 60, 'icon': 'partly-cloudy-day', 'precipIntensityMax': 0, 'sunriseTime': 1468316211, 'cloudCover': 0.11, 'temperatureMax': 83.93, 'precipIntensity': 0, 'pressure': 1016.84, 'windSpeed': 8.11, 'apparentTemperatureMaxTime': 1468357200, 'temperatureMaxTime': 1468357200, 'summary': 'Partly cloudy starting in the afternoon, continuing until evening.', 'sunsetTime': 1468369724, 'apparentTemperatureMinTime': 1468321200}]}, 'longitude': -74.0063889, 'minutely': {'icon': 'partly-cloudy-day', 'summary': 'Partly cloudy for the hour.', 'data': [{'time': 1467745680, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467745740, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467745800, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467745860, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467745920, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467745980, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746040, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746100, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746160, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746220, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746280, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746340, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746400, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746460, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746520, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746580, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746640, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746700, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746760, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746820, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746880, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467746940, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747000, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747060, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747120, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747180, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747240, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747300, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747360, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747420, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747480, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747540, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747600, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747660, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747720, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747780, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747840, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747900, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467747960, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748020, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748080, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748140, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748200, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748260, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748320, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748380, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748440, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748500, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748560, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748620, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748680, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467748740, 'precipType': 'rain', 'precipIntensity': 0.0065, 'precipProbability': 0.01, 'precipIntensityError': 0.0036}, {'time': 1467748800, 'precipType': 'rain', 'precipIntensity': 0.0062, 'precipProbability': 0.01, 'precipIntensityError': 0.0035}, {'time': 1467748860, 'precipType': 'rain', 'precipIntensity': 0.006, 'precipProbability': 0.01, 'precipIntensityError': 0.0034}, {'time': 1467748920, 'precipType': 'rain', 'precipIntensity': 0.0061, 'precipProbability': 0.01, 'precipIntensityError': 0.0035}, {'time': 1467748980, 'precipType': 'rain', 'precipIntensity': 0.0059, 'precipProbability': 0.01, 'precipIntensityError': 0.0035}, {'time': 1467749040, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467749100, 'precipIntensity': 0, 'precipProbability': 0}, {'time': 1467749160, 'precipType': 'rain', 'precipIntensity': 0.0061, 'precipProbability': 0.01, 'precipIntensityError': 0.0034}, {'time': 1467749220, 'precipType': 'rain', 'precipIntensity': 0.006, 'precipProbability': 0.01, 'precipIntensityError': 0.0034}, {'time': 1467749280, 'precipIntensity': 0, 'precipProbability': 0}]}, 'currently': {'humidity': 0.6, 'icon': 'partly-cloudy-day', 'windSpeed': 3.1, 'cloudCover': 0.36, 'ozone': 315.76, 'precipIntensity': 0, 'pressure': 1007.69, 'summary': 'Partly Cloudy', 'time': 1467745701, 'nearestStormDistance': 108, 'precipProbability': 0, 'windBearing': 292, 'apparentTemperature': 89.04, 'dewPoint': 69.49, 'temperature': 84.84, 'visibility': 10, 'nearestStormBearing': 290}, 'offset': -4, 'hourly': {'icon': 'partly-cloudy-day', 'summary': 'Partly cloudy tomorrow morning.', 'data': [{'humidity': 0.61, 'icon': 'partly-cloudy-day', 'ozone': 316.26, 'cloudCover': 0.35, 'dewPoint': 69.65, 'precipIntensity': 0, 'pressure': 1007.71, 'windBearing': 294, 'time': 1467745200, 'windSpeed': 2.87, 'summary': 'Partly Cloudy', 'apparentTemperature': 89.05, 'precipProbability': 0, 'temperature': 84.77, 'visibility': 10}, {'humidity': 0.57, 'icon': 'partly-cloudy-day', 'ozone': 312.69, 'cloudCover': 0.39, 'dewPoint': 68.49, 'precipIntensity': 0.0024, 'precipProbability': 0.01, 'pressure': 1007.56, 'windBearing': 283, 'time': 1467748800, 'windSpeed': 4.59, 'summary': 'Partly Cloudy', 'apparentTemperature': 88.95, 'precipType': 'rain', 'temperature': 85.3, 'visibility': 10}, {'humidity': 0.55, 'icon': 'partly-cloudy-day', 'ozone': 309.49, 'cloudCover': 0.4, 'dewPoint': 68.28, 'precipIntensity': 0.0021, 'precipProbability': 0.05, 'pressure': 1007.54, 'windBearing': 276, 'time': 1467752400, 'windSpeed': 4.63, 'summary': 'Partly Cloudy', 'apparentTemperature': 89.87, 'precipType': 'rain', 'temperature': 86.23, 'visibility': 10}, {'humidity': 0.55, 'icon': 'partly-cloudy-day', 'ozone': 307.27, 'cloudCover': 0.3, 'dewPoint': 68.06, 'precipIntensity': 0, 'pressure': 1007.67, 'windBearing': 269, 'time': 1467756000, 'windSpeed': 4.56, 'summary': 'Partly Cloudy', 'apparentTemperature': 89.58, 'precipProbability': 0, 'temperature': 86.09, 'visibility': 10}, {'humidity': 0.56, 'icon': 'clear-day', 'ozone': 305.43, 'cloudCover': 0.22, 'dewPoint': 67.92, 'precipIntensity': 0, 'pressure': 1007.92, 'windBearing': 261, 'time': 1467759600, 'windSpeed': 3.98, 'summary': 'Clear', 'apparentTemperature': 88.74, 'precipProbability': 0, 'temperature': 85.41, 'visibility': 10}, {'humidity': 0.58, 'icon': 'clear-day', 'ozone': 303.86, 'cloudCover': 0.16, 'dewPoint': 67.67, 'precipIntensity': 0, 'pressure': 1008.24, 'windBearing': 246, 'time': 1467763200, 'windSpeed': 3.33, 'summary': 'Clear', 'apparentTemperature': 86.81, 'precipProbability': 0, 'temperature': 83.8, 'visibility': 10}, {'humidity': 0.61, 'icon': 'clear-night', 'ozone': 302.67, 'cloudCover': 0.11, 'dewPoint': 67.48, 'precipIntensity': 0, 'pressure': 1008.7, 'windBearing': 237, 'time': 1467766800, 'windSpeed': 3.17, 'summary': 'Clear', 'apparentTemperature': 84.93, 'precipProbability': 0, 'temperature': 82.18, 'visibility': 10}, {'humidity': 0.64, 'icon': 'clear-night', 'ozone': 301.76, 'cloudCover': 0.09, 'dewPoint': 67.53, 'precipIntensity': 0, 'pressure': 1009.26, 'windBearing': 251, 'time': 1467770400, 'windSpeed': 2.98, 'summary': 'Clear', 'apparentTemperature': 83.5, 'precipProbability': 0, 'temperature': 80.9, 'visibility': 10}, {'humidity': 0.66, 'icon': 'clear-night', 'ozone': 300.69, 'cloudCover': 0.1, 'dewPoint': 67.42, 'precipIntensity': 0, 'pressure': 1009.73, 'windBearing': 260, 'time': 1467774000, 'windSpeed': 3.56, 'summary': 'Clear', 'apparentTemperature': 79.77, 'precipProbability': 0, 'temperature': 79.77, 'visibility': 10}, {'humidity': 0.68, 'icon': 'clear-night', 'ozone': 299.12, 'cloudCover': 0.12, 'dewPoint': 67.29, 'precipIntensity': 0, 'pressure': 1010.02, 'windBearing': 266, 'time': 1467777600, 'windSpeed': 3.65, 'summary': 'Clear', 'apparentTemperature': 78.73, 'precipProbability': 0, 'temperature': 78.73, 'visibility': 10}, {'humidity': 0.7, 'icon': 'clear-night', 'ozone': 297.38, 'cloudCover': 0.11, 'dewPoint': 66.98, 'precipIntensity': 0, 'pressure': 1010.22, 'windBearing': 266, 'time': 1467781200, 'windSpeed': 3.25, 'summary': 'Clear', 'apparentTemperature': 77.7, 'precipProbability': 0, 'temperature': 77.7, 'visibility': 10}, {'humidity': 0.72, 'icon': 'clear-night', 'ozone': 295.99, 'cloudCover': 0.15, 'dewPoint': 66.74, 'precipIntensity': 0, 'pressure': 1010.41, 'windBearing': 272, 'time': 1467784800, 'windSpeed': 3.12, 'summary': 'Clear', 'apparentTemperature': 76.54, 'precipProbability': 0, 'temperature': 76.54, 'visibility': 9.99}, {'humidity': 0.74, 'icon': 'clear-night', 'ozone': 295.18, 'cloudCover': 0.19, 'dewPoint': 66.16, 'precipIntensity': 0, 'pressure': 1010.54, 'windBearing': 284, 'time': 1467788400, 'windSpeed': 3.14, 'summary': 'Clear', 'apparentTemperature': 75.19, 'precipProbability': 0, 'temperature': 75.19, 'visibility': 9.97}, {'humidity': 0.75, 'icon': 'clear-night', 'ozone': 294.73, 'cloudCover': 0.2, 'dewPoint': 65.61, 'precipIntensity': 0, 'pressure': 1010.66, 'windBearing': 291, 'time': 1467792000, 'windSpeed': 3.25, 'summary': 'Clear', 'apparentTemperature': 73.98, 'precipProbability': 0, 'temperature': 73.98, 'visibility': 9.89}, {'humidity': 0.76, 'icon': 'clear-night', 'ozone': 294.39, 'cloudCover': 0.21, 'dewPoint': 65.11, 'precipIntensity': 0, 'pressure': 1010.87, 'windBearing': 292, 'time': 1467795600, 'windSpeed': 3.06, 'summary': 'Clear', 'apparentTemperature': 73.29, 'precipProbability': 0, 'temperature': 73.29, 'visibility': 9.76}, {'humidity': 0.75, 'icon': 'partly-cloudy-day', 'ozone': 294.09, 'cloudCover': 0.26, 'dewPoint': 65.44, 'precipIntensity': 0, 'pressure': 1011.31, 'windBearing': 307, 'time': 1467799200, 'windSpeed': 3.07, 'summary': 'Partly Cloudy', 'apparentTemperature': 73.71, 'precipProbability': 0, 'temperature': 73.71, 'visibility': 9.77}, {'humidity': 0.7, 'icon': 'partly-cloudy-day', 'ozone': 293.91, 'cloudCover': 0.26, 'dewPoint': 65.75, 'precipIntensity': 0, 'pressure': 1011.85, 'windBearing': 319, 'time': 1467802800, 'windSpeed': 3.58, 'summary': 'Partly Cloudy', 'apparentTemperature': 76.06, 'precipProbability': 0, 'temperature': 76.06, 'visibility': 9.99}, {'humidity': 0.68, 'icon': 'partly-cloudy-day', 'ozone': 293.83, 'cloudCover': 0.27, 'dewPoint': 66.47, 'precipIntensity': 0, 'pressure': 1012.23, 'windBearing': 311, 'time': 1467806400, 'windSpeed': 2.94, 'summary': 'Partly Cloudy', 'apparentTemperature': 77.7, 'precipProbability': 0, 'temperature': 77.7, 'visibility': 9.99}, {'humidity': 0.65, 'icon': 'partly-cloudy-day', 'ozone': 293.97, 'cloudCover': 0.27, 'dewPoint': 66.71, 'precipIntensity': 0, 'pressure': 1012.33, 'windBearing': 309, 'time': 1467810000, 'windSpeed': 2.82, 'summary': 'Partly Cloudy', 'apparentTemperature': 79.55, 'precipProbability': 0, 'temperature': 79.55, 'visibility': 10}, {'humidity': 0.6, 'icon': 'partly-cloudy-day', 'ozone': 294.22, 'cloudCover': 0.26, 'dewPoint': 66.63, 'precipIntensity': 0, 'pressure': 1012.26, 'windBearing': 305, 'time': 1467813600, 'windSpeed': 2.57, 'summary': 'Partly Cloudy', 'apparentTemperature': 84.3, 'precipProbability': 0, 'temperature': 81.91, 'visibility': 10}, {'humidity': 0.56, 'icon': 'partly-cloudy-day', 'ozone': 294.17, 'cloudCover': 0.28, 'dewPoint': 66.36, 'precipIntensity': 0, 'pressure': 1012.13, 'windBearing': 275, 'time': 1467817200, 'windSpeed': 2.41, 'summary': 'Partly Cloudy', 'apparentTemperature': 86.24, 'precipProbability': 0, 'temperature': 83.86, 'visibility': 10}, {'humidity': 0.52, 'icon': 'clear-day', 'ozone': 293.53, 'cloudCover': 0.24, 'dewPoint': 66.54, 'precipIntensity': 0, 'pressure': 1011.96, 'windBearing': 245, 'time': 1467820800, 'windSpeed': 2.98, 'summary': 'Clear', 'apparentTemperature': 88.63, 'precipProbability': 0, 'temperature': 86.02, 'visibility': 10}, {'humidity': 0.5, 'icon': 'clear-day', 'ozone': 292.59, 'cloudCover': 0.21, 'dewPoint': 66.86, 'precipIntensity': 0, 'pressure': 1011.72, 'windBearing': 235, 'time': 1467824400, 'windSpeed': 3.91, 'summary': 'Clear', 'apparentTemperature': 90.56, 'precipProbability': 0, 'temperature': 87.64, 'visibility': 10}, {'humidity': 0.49, 'icon': 'clear-day', 'ozone': 291.89, 'cloudCover': 0.2, 'dewPoint': 67.29, 'precipIntensity': 0, 'pressure': 1011.42, 'windBearing': 227, 'time': 1467828000, 'windSpeed': 4.59, 'summary': 'Clear', 'apparentTemperature': 92.39, 'precipProbability': 0, 'temperature': 89.03, 'visibility': 10}, {'humidity': 0.49, 'icon': 'clear-day', 'ozone': 291.59, 'cloudCover': 0.14, 'dewPoint': 67.81, 'precipIntensity': 0, 'pressure': 1010.98, 'windBearing': 210, 'time': 1467831600, 'windSpeed': 4.96, 'summary': 'Clear', 'apparentTemperature': 93.14, 'precipProbability': 0, 'temperature': 89.38, 'visibility': 10}, {'humidity': 0.5, 'icon': 'clear-day', 'ozone': 291.53, 'cloudCover': 0.16, 'dewPoint': 68.74, 'precipIntensity': 0, 'pressure': 1010.48, 'windBearing': 202, 'time': 1467835200, 'windSpeed': 5.4, 'summary': 'Clear', 'apparentTemperature': 94.71, 'precipProbability': 0, 'temperature': 90.15, 'visibility': 10}, {'humidity': 0.51, 'icon': 'clear-day', 'ozone': 291.66, 'cloudCover': 0.19, 'dewPoint': 69.24, 'precipIntensity': 0, 'pressure': 1010.11, 'windBearing': 196, 'time': 1467838800, 'windSpeed': 5.73, 'summary': 'Clear', 'apparentTemperature': 94.6, 'precipProbability': 0, 'temperature': 89.72, 'visibility': 10}, {'humidity': 0.55, 'icon': 'clear-day', 'ozone': 292.05, 'cloudCover': 0.19, 'dewPoint': 69.85, 'precipIntensity': 0, 'pressure': 1009.99, 'windBearing': 193, 'time': 1467842400, 'windSpeed': 5.92, 'summary': 'Clear', 'apparentTemperature': 93.41, 'precipProbability': 0, 'temperature': 88.32, 'visibility': 10}, {'humidity': 0.59, 'icon': 'clear-day', 'ozone': 292.63, 'cloudCover': 0.18, 'dewPoint': 70.42, 'precipIntensity': 0, 'pressure': 1009.99, 'windBearing': 193, 'time': 1467846000, 'windSpeed': 5.92, 'summary': 'Clear', 'apparentTemperature': 91.47, 'precipProbability': 0, 'temperature': 86.34, 'visibility': 10}, {'humidity': 0.64, 'icon': 'clear-day', 'ozone': 293.2, 'cloudCover': 0.16, 'dewPoint': 71.14, 'precipIntensity': 0, 'pressure': 1010.11, 'windBearing': 188, 'time': 1467849600, 'windSpeed': 6.39, 'summary': 'Clear', 'apparentTemperature': 89.71, 'precipProbability': 0, 'temperature': 84.51, 'visibility': 10}, {'humidity': 0.69, 'icon': 'clear-night', 'ozone': 293.77, 'cloudCover': 0.15, 'dewPoint': 71.7, 'precipIntensity': 0, 'pressure': 1010.42, 'windBearing': 195, 'time': 1467853200, 'windSpeed': 5.98, 'summary': 'Clear', 'apparentTemperature': 88.03, 'precipProbability': 0, 'temperature': 82.96, 'visibility': 10}, {'humidity': 0.74, 'icon': 'clear-night', 'ozone': 294.32, 'cloudCover': 0.15, 'dewPoint': 72.29, 'precipIntensity': 0, 'pressure': 1010.87, 'windBearing': 193, 'time': 1467856800, 'windSpeed': 5.46, 'summary': 'Clear', 'apparentTemperature': 86.38, 'precipProbability': 0, 'temperature': 81.58, 'visibility': 10}, {'humidity': 0.77, 'icon': 'clear-night', 'ozone': 294.56, 'cloudCover': 0.15, 'dewPoint': 72.46, 'precipIntensity': 0, 'pressure': 1011.15, 'windBearing': 191, 'time': 1467860400, 'windSpeed': 4.92, 'summary': 'Clear', 'apparentTemperature': 84.38, 'precipProbability': 0, 'temperature': 80.26, 'visibility': 10}, {'humidity': 0.79, 'icon': 'clear-night', 'ozone': 294.2, 'cloudCover': 0.17, 'dewPoint': 72.03, 'precipIntensity': 0, 'pressure': 1011, 'windBearing': 195, 'time': 1467864000, 'windSpeed': 4.15, 'summary': 'Clear', 'apparentTemperature': 78.97, 'precipProbability': 0, 'temperature': 78.97, 'visibility': 10}, {'humidity': 0.81, 'icon': 'clear-night', 'ozone': 293.53, 'cloudCover': 0.2, 'dewPoint': 71.2, 'precipIntensity': 0, 'pressure': 1010.7, 'windBearing': 205, 'time': 1467867600, 'windSpeed': 3.17, 'summary': 'Clear', 'apparentTemperature': 77.66, 'precipProbability': 0, 'temperature': 77.66, 'visibility': 10}, {'humidity': 0.81, 'icon': 'clear-night', 'ozone': 293.14, 'cloudCover': 0.24, 'dewPoint': 70.35, 'precipIntensity': 0, 'pressure': 1010.44, 'windBearing': 219, 'time': 1467871200, 'windSpeed': 2.41, 'summary': 'Clear', 'apparentTemperature': 76.45, 'precipProbability': 0, 'temperature': 76.45, 'visibility': 10}, {'humidity': 0.83, 'icon': 'partly-cloudy-night', 'ozone': 293.35, 'cloudCover': 0.28, 'dewPoint': 69.55, 'precipIntensity': 0, 'pressure': 1010.19, 'windBearing': 228, 'time': 1467874800, 'windSpeed': 2.06, 'summary': 'Partly Cloudy', 'apparentTemperature': 75.23, 'precipProbability': 0, 'temperature': 75.23, 'visibility': 10}, {'humidity': 0.83, 'icon': 'partly-cloudy-night', 'ozone': 293.84, 'cloudCover': 0.33, 'dewPoint': 68.82, 'precipIntensity': 0, 'pressure': 1009.88, 'windBearing': 232, 'time': 1467878400, 'windSpeed': 1.85, 'summary': 'Partly Cloudy', 'apparentTemperature': 74.17, 'precipProbability': 0, 'temperature': 74.17, 'visibility': 10}, {'humidity': 0.83, 'icon': 'partly-cloudy-night', 'ozone': 294.3, 'cloudCover': 0.35, 'dewPoint': 68.33, 'precipIntensity': 0, 'pressure': 1009.71, 'windBearing': 234, 'time': 1467882000, 'windSpeed': 1.8, 'summary': 'Partly Cloudy', 'apparentTemperature': 73.73, 'precipProbability': 0, 'temperature': 73.73, 'visibility': 10}, {'humidity': 0.82, 'icon': 'partly-cloudy-day', 'ozone': 294.65, 'cloudCover': 0.33, 'dewPoint': 68.69, 'precipIntensity': 0, 'pressure': 1009.85, 'windBearing': 236, 'time': 1467885600, 'windSpeed': 1.97, 'summary': 'Partly Cloudy', 'apparentTemperature': 74.67, 'precipProbability': 0, 'temperature': 74.67, 'visibility': 10}, {'humidity': 0.79, 'icon': 'partly-cloudy-day', 'ozone': 294.98, 'cloudCover': 0.27, 'dewPoint': 69.15, 'precipIntensity': 0, 'pressure': 1010.13, 'windBearing': 235, 'time': 1467889200, 'windSpeed': 2.27, 'summary': 'Partly Cloudy', 'apparentTemperature': 76.12, 'precipProbability': 0, 'temperature': 76.12, 'visibility': 10}, {'humidity': 0.76, 'icon': 'clear-day', 'ozone': 295.23, 'cloudCover': 0.24, 'dewPoint': 69.48, 'precipIntensity': 0, 'pressure': 1010.27, 'windBearing': 225, 'time': 1467892800, 'windSpeed': 2.57, 'summary': 'Clear', 'apparentTemperature': 77.75, 'precipProbability': 0, 'temperature': 77.75, 'visibility': 10}, {'humidity': 0.71, 'icon': 'partly-cloudy-day', 'ozone': 295.44, 'cloudCover': 0.25, 'dewPoint': 69.66, 'precipIntensity': 0, 'pressure': 1010.24, 'windBearing': 208, 'time': 1467896400, 'windSpeed': 3.34, 'summary': 'Partly Cloudy', 'apparentTemperature': 79.82, 'precipProbability': 0, 'temperature': 79.82, 'visibility': 10}, {'humidity': 0.66, 'icon': 'partly-cloudy-day', 'ozone': 295.57, 'cloudCover': 0.28, 'dewPoint': 69.89, 'precipIntensity': 0.0009, 'precipProbability': 0.01, 'pressure': 1010.1, 'windBearing': 196, 'time': 1467900000, 'windSpeed': 4.6, 'summary': 'Partly Cloudy', 'apparentTemperature': 86.34, 'precipType': 'rain', 'temperature': 82.44, 'visibility': 10}, {'humidity': 0.62, 'icon': 'partly-cloudy-day', 'ozone': 295.49, 'cloudCover': 0.31, 'dewPoint': 70.29, 'precipIntensity': 0.0013, 'precipProbability': 0.02, 'pressure': 1009.89, 'windBearing': 187, 'time': 1467903600, 'windSpeed': 5.84, 'summary': 'Partly Cloudy', 'apparentTemperature': 89.71, 'precipType': 'rain', 'temperature': 84.97, 'visibility': 10}, {'humidity': 0.59, 'icon': 'partly-cloudy-day', 'ozone': 294.97, 'cloudCover': 0.33, 'dewPoint': 70.95, 'precipIntensity': 0, 'pressure': 1009.62, 'windBearing': 175, 'time': 1467907200, 'windSpeed': 6.96, 'summary': 'Partly Cloudy', 'apparentTemperature': 92.77, 'precipProbability': 0, 'temperature': 87.06, 'visibility': 10}, {'humidity': 0.57, 'icon': 'partly-cloudy-day', 'ozone': 294.23, 'cloudCover': 0.35, 'dewPoint': 71.81, 'precipIntensity': 0, 'pressure': 1009.28, 'windBearing': 164, 'time': 1467910800, 'windSpeed': 8.14, 'summary': 'Partly Cloudy', 'apparentTemperature': 95.67, 'precipProbability': 0, 'temperature': 88.8, 'visibility': 10}, {'humidity': 0.57, 'icon': 'partly-cloudy-day', 'ozone': 293.73, 'cloudCover': 0.37, 'dewPoint': 72.66, 'precipIntensity': 0.0018, 'precipProbability': 0.04, 'pressure': 1008.95, 'windBearing': 159, 'time': 1467914400, 'windSpeed': 9.06, 'summary': 'Partly Cloudy', 'apparentTemperature': 97.73, 'precipType': 'rain', 'temperature': 89.78, 'visibility': 10}, {'humidity': 0.59, 'icon': 'rain', 'ozone': 293.58, 'cloudCover': 0.39, 'dewPoint': 73.07, 'precipIntensity': 0.0491, 'precipProbability': 0.61, 'pressure': 1008.6, 'windBearing': 159, 'time': 1467918000, 'windSpeed': 9.42, 'summary': 'Light Rain', 'apparentTemperature': 97.62, 'precipType': 'rain', 'temperature': 89.37, 'visibility': 10}]}, 'timezone': 'America/New_York'}
In [5]:
data.keys()
Out[5]:
dict_keys(['latitude', 'flags', 'daily', 'longitude', 'minutely', 'currently', 'offset', 'hourly', 'timezone'])
In [6]:
data['currently']
Out[6]:
{'apparentTemperature': 89.04,
'cloudCover': 0.36,
'dewPoint': 69.49,
'humidity': 0.6,
'icon': 'partly-cloudy-day',
'nearestStormBearing': 290,
'nearestStormDistance': 108,
'ozone': 315.76,
'precipIntensity': 0,
'precipProbability': 0,
'pressure': 1007.69,
'summary': 'Partly Cloudy',
'temperature': 84.84,
'time': 1467745701,
'visibility': 10,
'windBearing': 292,
'windSpeed': 3.1}
In [36]:
temperature=str(data['currently']['temperature'])
summary=data['currently']['summary']
In [8]:
data['daily']
Out[8]:
{'data': [{'apparentTemperatureMax': 89.87,
'apparentTemperatureMaxTime': 1467752400,
'apparentTemperatureMin': 69.53,
'apparentTemperatureMinTime': 1467698400,
'cloudCover': 0.55,
'dewPoint': 68.6,
'humidity': 0.76,
'icon': 'rain',
'moonPhase': 0.05,
'ozone': 302.93,
'precipIntensity': 0.0203,
'precipIntensityMax': 0.0915,
'precipIntensityMaxTime': 1467698400,
'precipProbability': 0.66,
'precipType': 'rain',
'pressure': 1008.86,
'summary': 'Rain in the morning.',
'sunriseTime': 1467711130,
'sunsetTime': 1467765086,
'temperatureMax': 86.23,
'temperatureMaxTime': 1467752400,
'temperatureMin': 69.53,
'temperatureMinTime': 1467698400,
'time': 1467691200,
'visibility': 7.73,
'windBearing': 259,
'windSpeed': 2.12},
{'apparentTemperatureMax': 94.71,
'apparentTemperatureMaxTime': 1467835200,
'apparentTemperatureMin': 73.29,
'apparentTemperatureMinTime': 1467795600,
'cloudCover': 0.2,
'dewPoint': 67.9,
'humidity': 0.64,
'icon': 'partly-cloudy-day',
'moonPhase': 0.08,
'ozone': 293.93,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1011,
'summary': 'Partly cloudy in the morning.',
'sunriseTime': 1467797567,
'sunsetTime': 1467851468,
'temperatureMax': 90.15,
'temperatureMaxTime': 1467835200,
'temperatureMin': 73.29,
'temperatureMinTime': 1467795600,
'time': 1467777600,
'visibility': 9.97,
'windBearing': 232,
'windSpeed': 2.91},
{'apparentTemperatureMax': 97.73,
'apparentTemperatureMaxTime': 1467914400,
'apparentTemperatureMin': 73.73,
'apparentTemperatureMinTime': 1467882000,
'cloudCover': 0.32,
'dewPoint': 71.64,
'humidity': 0.73,
'icon': 'rain',
'moonPhase': 0.11,
'ozone': 295.01,
'precipIntensity': 0.0212,
'precipIntensityMax': 0.1398,
'precipIntensityMaxTime': 1467925200,
'precipProbability': 0.7,
'precipType': 'rain',
'pressure': 1009.36,
'summary': 'Rain starting in the afternoon.',
'sunriseTime': 1467884004,
'sunsetTime': 1467937849,
'temperatureMax': 89.78,
'temperatureMaxTime': 1467914400,
'temperatureMin': 73.73,
'temperatureMinTime': 1467882000,
'time': 1467864000,
'visibility': 10,
'windBearing': 175,
'windSpeed': 5.13},
{'apparentTemperatureMax': 94.16,
'apparentTemperatureMaxTime': 1468011600,
'apparentTemperatureMin': 74.11,
'apparentTemperatureMinTime': 1467975600,
'cloudCover': 0.59,
'dewPoint': 72.61,
'humidity': 0.8,
'icon': 'rain',
'moonPhase': 0.15,
'ozone': 300.76,
'precipIntensity': 0.0086,
'precipIntensityMax': 0.0234,
'precipIntensityMaxTime': 1467979200,
'precipProbability': 0.53,
'precipType': 'rain',
'pressure': 1007.17,
'summary': 'Light rain in the morning and afternoon.',
'sunriseTime': 1467970443,
'sunsetTime': 1468024228,
'temperatureMax': 85.79,
'temperatureMaxTime': 1468011600,
'temperatureMin': 74.11,
'temperatureMinTime': 1467975600,
'time': 1467950400,
'visibility': 10,
'windBearing': 167,
'windSpeed': 3.02},
{'apparentTemperatureMax': 88.78,
'apparentTemperatureMaxTime': 1468094400,
'apparentTemperatureMin': 73.23,
'apparentTemperatureMinTime': 1468062000,
'cloudCover': 0.36,
'dewPoint': 70.43,
'humidity': 0.76,
'icon': 'rain',
'moonPhase': 0.18,
'ozone': 305.18,
'precipIntensity': 0.0081,
'precipIntensityMax': 0.0279,
'precipIntensityMaxTime': 1468054800,
'precipProbability': 0.55,
'precipType': 'rain',
'pressure': 1005.93,
'summary': 'Light rain in the morning.',
'sunriseTime': 1468056884,
'sunsetTime': 1468110605,
'temperatureMax': 84.85,
'temperatureMaxTime': 1468094400,
'temperatureMin': 73.23,
'temperatureMinTime': 1468062000,
'time': 1468036800,
'windBearing': 242,
'windSpeed': 10.44},
{'apparentTemperatureMax': 83.43,
'apparentTemperatureMaxTime': 1468188000,
'apparentTemperatureMin': 70.37,
'apparentTemperatureMinTime': 1468152000,
'cloudCover': 0,
'dewPoint': 62.89,
'humidity': 0.66,
'icon': 'wind',
'moonPhase': 0.21,
'ozone': 332.27,
'precipIntensity': 0.0007,
'precipIntensityMax': 0.0011,
'precipIntensityMaxTime': 1468123200,
'precipProbability': 0.02,
'precipType': 'rain',
'pressure': 1008.81,
'summary': 'Breezy in the morning.',
'sunriseTime': 1468143325,
'sunsetTime': 1468196980,
'temperatureMax': 81.82,
'temperatureMaxTime': 1468188000,
'temperatureMin': 70.37,
'temperatureMinTime': 1468152000,
'time': 1468123200,
'windBearing': 280,
'windSpeed': 14.96},
{'apparentTemperatureMax': 84.27,
'apparentTemperatureMaxTime': 1468274400,
'apparentTemperatureMin': 69.09,
'apparentTemperatureMinTime': 1468234800,
'cloudCover': 0,
'dewPoint': 61.32,
'humidity': 0.61,
'icon': 'clear-day',
'moonPhase': 0.24,
'ozone': 329.39,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1015.03,
'summary': 'Clear throughout the day.',
'sunriseTime': 1468229768,
'sunsetTime': 1468283353,
'temperatureMax': 82.81,
'temperatureMaxTime': 1468274400,
'temperatureMin': 69.09,
'temperatureMinTime': 1468234800,
'time': 1468209600,
'windBearing': 286,
'windSpeed': 9.59},
{'apparentTemperatureMax': 84.75,
'apparentTemperatureMaxTime': 1468357200,
'apparentTemperatureMin': 69.14,
'apparentTemperatureMinTime': 1468321200,
'cloudCover': 0.11,
'dewPoint': 60,
'humidity': 0.56,
'icon': 'partly-cloudy-day',
'moonPhase': 0.27,
'ozone': 311.37,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1016.84,
'summary': 'Partly cloudy starting in the afternoon, continuing until evening.',
'sunriseTime': 1468316211,
'sunsetTime': 1468369724,
'temperatureMax': 83.93,
'temperatureMaxTime': 1468357200,
'temperatureMin': 69.14,
'temperatureMinTime': 1468321200,
'time': 1468296000,
'windBearing': 308,
'windSpeed': 8.11}],
'icon': 'rain',
'summary': 'Rain today through Saturday, with temperatures falling to 82°F on Sunday.'}
In [9]:
data['daily'].keys()
Out[9]:
dict_keys(['icon', 'summary', 'data'])
In [10]:
data['daily']['data']
Out[10]:
[{'apparentTemperatureMax': 89.87,
'apparentTemperatureMaxTime': 1467752400,
'apparentTemperatureMin': 69.53,
'apparentTemperatureMinTime': 1467698400,
'cloudCover': 0.55,
'dewPoint': 68.6,
'humidity': 0.76,
'icon': 'rain',
'moonPhase': 0.05,
'ozone': 302.93,
'precipIntensity': 0.0203,
'precipIntensityMax': 0.0915,
'precipIntensityMaxTime': 1467698400,
'precipProbability': 0.66,
'precipType': 'rain',
'pressure': 1008.86,
'summary': 'Rain in the morning.',
'sunriseTime': 1467711130,
'sunsetTime': 1467765086,
'temperatureMax': 86.23,
'temperatureMaxTime': 1467752400,
'temperatureMin': 69.53,
'temperatureMinTime': 1467698400,
'time': 1467691200,
'visibility': 7.73,
'windBearing': 259,
'windSpeed': 2.12},
{'apparentTemperatureMax': 94.71,
'apparentTemperatureMaxTime': 1467835200,
'apparentTemperatureMin': 73.29,
'apparentTemperatureMinTime': 1467795600,
'cloudCover': 0.2,
'dewPoint': 67.9,
'humidity': 0.64,
'icon': 'partly-cloudy-day',
'moonPhase': 0.08,
'ozone': 293.93,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1011,
'summary': 'Partly cloudy in the morning.',
'sunriseTime': 1467797567,
'sunsetTime': 1467851468,
'temperatureMax': 90.15,
'temperatureMaxTime': 1467835200,
'temperatureMin': 73.29,
'temperatureMinTime': 1467795600,
'time': 1467777600,
'visibility': 9.97,
'windBearing': 232,
'windSpeed': 2.91},
{'apparentTemperatureMax': 97.73,
'apparentTemperatureMaxTime': 1467914400,
'apparentTemperatureMin': 73.73,
'apparentTemperatureMinTime': 1467882000,
'cloudCover': 0.32,
'dewPoint': 71.64,
'humidity': 0.73,
'icon': 'rain',
'moonPhase': 0.11,
'ozone': 295.01,
'precipIntensity': 0.0212,
'precipIntensityMax': 0.1398,
'precipIntensityMaxTime': 1467925200,
'precipProbability': 0.7,
'precipType': 'rain',
'pressure': 1009.36,
'summary': 'Rain starting in the afternoon.',
'sunriseTime': 1467884004,
'sunsetTime': 1467937849,
'temperatureMax': 89.78,
'temperatureMaxTime': 1467914400,
'temperatureMin': 73.73,
'temperatureMinTime': 1467882000,
'time': 1467864000,
'visibility': 10,
'windBearing': 175,
'windSpeed': 5.13},
{'apparentTemperatureMax': 94.16,
'apparentTemperatureMaxTime': 1468011600,
'apparentTemperatureMin': 74.11,
'apparentTemperatureMinTime': 1467975600,
'cloudCover': 0.59,
'dewPoint': 72.61,
'humidity': 0.8,
'icon': 'rain',
'moonPhase': 0.15,
'ozone': 300.76,
'precipIntensity': 0.0086,
'precipIntensityMax': 0.0234,
'precipIntensityMaxTime': 1467979200,
'precipProbability': 0.53,
'precipType': 'rain',
'pressure': 1007.17,
'summary': 'Light rain in the morning and afternoon.',
'sunriseTime': 1467970443,
'sunsetTime': 1468024228,
'temperatureMax': 85.79,
'temperatureMaxTime': 1468011600,
'temperatureMin': 74.11,
'temperatureMinTime': 1467975600,
'time': 1467950400,
'visibility': 10,
'windBearing': 167,
'windSpeed': 3.02},
{'apparentTemperatureMax': 88.78,
'apparentTemperatureMaxTime': 1468094400,
'apparentTemperatureMin': 73.23,
'apparentTemperatureMinTime': 1468062000,
'cloudCover': 0.36,
'dewPoint': 70.43,
'humidity': 0.76,
'icon': 'rain',
'moonPhase': 0.18,
'ozone': 305.18,
'precipIntensity': 0.0081,
'precipIntensityMax': 0.0279,
'precipIntensityMaxTime': 1468054800,
'precipProbability': 0.55,
'precipType': 'rain',
'pressure': 1005.93,
'summary': 'Light rain in the morning.',
'sunriseTime': 1468056884,
'sunsetTime': 1468110605,
'temperatureMax': 84.85,
'temperatureMaxTime': 1468094400,
'temperatureMin': 73.23,
'temperatureMinTime': 1468062000,
'time': 1468036800,
'windBearing': 242,
'windSpeed': 10.44},
{'apparentTemperatureMax': 83.43,
'apparentTemperatureMaxTime': 1468188000,
'apparentTemperatureMin': 70.37,
'apparentTemperatureMinTime': 1468152000,
'cloudCover': 0,
'dewPoint': 62.89,
'humidity': 0.66,
'icon': 'wind',
'moonPhase': 0.21,
'ozone': 332.27,
'precipIntensity': 0.0007,
'precipIntensityMax': 0.0011,
'precipIntensityMaxTime': 1468123200,
'precipProbability': 0.02,
'precipType': 'rain',
'pressure': 1008.81,
'summary': 'Breezy in the morning.',
'sunriseTime': 1468143325,
'sunsetTime': 1468196980,
'temperatureMax': 81.82,
'temperatureMaxTime': 1468188000,
'temperatureMin': 70.37,
'temperatureMinTime': 1468152000,
'time': 1468123200,
'windBearing': 280,
'windSpeed': 14.96},
{'apparentTemperatureMax': 84.27,
'apparentTemperatureMaxTime': 1468274400,
'apparentTemperatureMin': 69.09,
'apparentTemperatureMinTime': 1468234800,
'cloudCover': 0,
'dewPoint': 61.32,
'humidity': 0.61,
'icon': 'clear-day',
'moonPhase': 0.24,
'ozone': 329.39,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1015.03,
'summary': 'Clear throughout the day.',
'sunriseTime': 1468229768,
'sunsetTime': 1468283353,
'temperatureMax': 82.81,
'temperatureMaxTime': 1468274400,
'temperatureMin': 69.09,
'temperatureMinTime': 1468234800,
'time': 1468209600,
'windBearing': 286,
'windSpeed': 9.59},
{'apparentTemperatureMax': 84.75,
'apparentTemperatureMaxTime': 1468357200,
'apparentTemperatureMin': 69.14,
'apparentTemperatureMinTime': 1468321200,
'cloudCover': 0.11,
'dewPoint': 60,
'humidity': 0.56,
'icon': 'partly-cloudy-day',
'moonPhase': 0.27,
'ozone': 311.37,
'precipIntensity': 0,
'precipIntensityMax': 0,
'precipProbability': 0,
'pressure': 1016.84,
'summary': 'Partly cloudy starting in the afternoon, continuing until evening.',
'sunriseTime': 1468316211,
'sunsetTime': 1468369724,
'temperatureMax': 83.93,
'temperatureMaxTime': 1468357200,
'temperatureMin': 69.14,
'temperatureMinTime': 1468321200,
'time': 1468296000,
'windBearing': 308,
'windSpeed': 8.11}]
TEMP_FEELING is whether it will be hot, warm, cold, or moderate. You will probably use HIGH_TEMP and your own thoughts and feelings to determine this.
In [11]:
current_day=data['daily']['data']
In [40]:
high_temp=str(current_day[0]['temperatureMax'])
low_temp=str(current_day[0]['temperatureMin'])
In [41]:
for temp in current_day:
def temp_feeling(feel):
if temp['temperatureMax'] >= 80:
return "hot"
elif temp['temperatureMax'] >=72 and temp['temperatureMax'] <79:
return "warm"
elif temp['temperatureMax'] >= 65 and temp['temperatureMax'] < 71:
return "moderate"
elif temp['temperatureMax'] <64:
return "cold"
feel=temp_feeling(data)
In [42]:
for precip in current_day:
def rain_warning(rain):
if precip['precipIntensity'] >=0.1:
return "bring your embrella!"
else:
return
rain=rain_warning(data)
Right now it is TEMPERATURE degrees out and SUMMARY. Today will be TEMP_FEELING with a high of HIGH_TEMP and a low of LOW_TEMP. RAIN_WARNING.
In [43]:
print("Right now it is "+temperature +"degrees out and"+ summary+". "+ "Today will be"+ str(feel)+"with a high of "+high_temp+"and a low of "+low_temp+str(rain))
Right now it is 84.84degrees out andPartly Cloudy. Today will behotwith a high of 86.23and a low of 69.53None
Forecasts Part Two: Sending data
Using a mailgun.com account and their API, send yourself an email every morning at 8AM telling you the above sentence. The subject line of the email should be something like "8AM Weather forecast: January 1, 1970"
In [52]:
!pip install python-dateutil
Collecting python-dateutil
Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/local/lib/python3.5/site-packages (from python-dateutil)
Installing collected packages: python-dateutil
Successfully installed python-dateutil-2.5.3
In [53]:
import dateutil
import time,datetime
now = time.strftime("%B %d, %Y")
In [54]:
key='b26c4451559d29c03a88eda7578ac5b2'
sandbox='sandbox4f79497ef29d40889a4b2c09ba554074.mailgun.org'
recipient='shengyingzhao916@gmail.com'
request_url='https://api.mailgun.net/v2/{0}/messages'.format(sandbox)
request=requests.post(request_url, auth=('api', key), data={
'from': 'hello@example.com',
'to': recipient,
'subject': '8AM Weather forecast: January 1, 1970',
'text': 'text'
})
print 'Status: {0}'.format(request.status_code)
print 'Body: {0}'.format(request.text)
File "<ipython-input-54-6eaa99b1fc6f>", line 11
print 'Status: {0}'.format(request.status_code)
^
SyntaxError: invalid syntax
In [ ]:
Content source: sz2472/foundations-homework
Similar notebooks: