title: TypeError: 'NoneType' object is not subscriptable in Python
body: <p>I get this error and I don't know what the problem is.</p>
  <p>Code:</p>
  <pre><code>__author__ = 'victor'
  
  import requests
  import xmltodict
  url = 'http://webservices.ns.nl/ns-api-storingen?station=UT'
  user = 'victor_shao@hotmail.com'
  passw = 'dMHAg67WACsUdrQmqctr3giaTpTnsJmhPP2EcQWlVnMw3zmHXvSE-A'
  response = requests.get(url, auth=(user, passw))
  
  xmldi = xmltodict.parse(response.text)
  
  storing = 0
  allestoringen = 4
  
  print(&quot;Storingen&quot;,'\n','ongeplande storingen')
  print('{0:15s}'.format('id'),'{0:40s}'.format('traject'),'{0:20s}'.format('reden'),'{0:100s}'.format('bericht'),'{0:25s}'.format('datum'))
  for storing in range(0, allestoringen):
      id = xmldi['Storingen']['Ongepland']['Storing']['id']
      traject = xmldi['Storingen']['Ongepland']['Storing']['Traject']
      reden = xmldi['Storingen']['Ongepland']['Storing']['Reden']
      bericht = xmldi['Storingen']['Ongepland']['Storing']['Bericht']
      datum = xmldi['Storingen']['Ongepland'][&quot;Storing&quot;]['Datum']
  
  print(&quot;Geplande storingen &quot;)
  print('{0:25s)'.format('id'),'{0:40s}'.format('traject'),'{0:35s}'.format('periode'),'{0:200s}'.format('advies'),'{0:250s}'.format('bericht'),'{0:50s}'.format('oorzaak'),'{0:30s}'.format('vertraging'))
  for storing in range(0, allestoringen):
      id = xmldi['Storingen']['Gepland']['Storing']['id']
      traject = xmldi['Storingen']['Gepland']['Storing']['Traject']
      periode = xmldi['Storingen']['Gepland']['Storing']['Periode']
      advies = xmldi['Storingen']['Gepland']['Storing']['Advies']
      bericht = xmldi['Storingen']['Gepland']['Storing']['Bericht']
      oorzaak = xmldi['Storingen']['Gepland']['Storing']['Oorzaak']
      vertraging = xmldi['Storingen']['Gepland']['Storing']['Vertraging']
  </code></pre>
  <p>Here is the output, where I should fill in the information:</p>
  <blockquote>
  <p>C:\Python34\python.exe C:/Users/avi/PycharmProjects/untitled1/storing.py Storingen<br />
  ongeplande storingen id              traject<br />
  reden                bericht<br />
  datum                     Traceback (most recent call last):   File
  &quot;C:/Users/avi/PycharmProjects/untitled1/storing.py&quot;, line 18, in
  
  id = xmldi['Storingen']['Ongepland']['Storing']['id'] TypeError: 'NoneType' object is not subscriptable</p>
  <p>Process finished with exit code 1</p>
  </blockquote>
  <p>How can I fix this? I would appreciate any help.</p>