title: How to fix 'KeyError' when dealing with api response search?
body: <p>I am creating a weather app. I am attempting to pull weather data from an API. I receive a KeyError when executing the retrieving from the list. I blurred out my API key.</p>
  
  <p>I have trying setting the key to multiple different numbers and removing it completely. 'max' is a part of the api.</p>
  
  <pre><code>city = 'Syracuse'
  state = 'NY'
  url = ('https://api.openweathermap.org/data/2.5/forecast?q=%s,3166-2:US-%s&amp;APPID=**********' % (city,state))
  response = requests.get(url)
  weatherdata = response.json()
  weatherdata
  low = weatherdata[0]['temp_min']
  </code></pre>
  
  <p>The error occurs on the 7th line and reads </p>
  
  <pre><code>KeyError                                  Traceback (most recent call last)
  &lt;ipython-input-52-18029d6f472d&gt; in &lt;module&gt;
       25 weatherdata
       26 
  ---&gt; 27 low = weatherdata[0]['temp_min']
  
  KeyError: 0
  </code></pre>
  
  <p>Below is an example of what the response looks like. This is a fraction of what is returned.</p>
  
  <pre><code>{'cod': '200',
   'message': 0.0072,
   'cnt': 40,
   'list': [{'dt': 1557133200,
     'main': {'temp': 282.03,
      'temp_min': 279.7,
      'temp_max': 282.03,
      'pressure': 1013.3,
      'sea_level': 1013.3,
      'grnd_level': 989.64,
      'humidity': 96,
      'temp_kf': 2.33},
     'weather': [{'id': 800,
       'main': 'Clear',
       'description': 'clear sky',
       'icon': '01n'}],
     'clouds': {'all': 5},
     'wind': {'speed': 0.96, 'deg': 270.837},
     'sys': {'pod': 'n'},
     'dt_txt': '2019-05-06 09:00:00'},
  
  </code></pre>
  
  <p>I hope that the max temperature of the day will be set to 'high' and that I am able to repeat this process for the low of the day, humidity, and other conditions. So instead of the error, it will set high to the value and then I can print or use it later.</p>