title: I am getting a "'NoneType' object is not subscriptable" when trying to bring in data from a URL
body: <p>Here is my code:</p>
  <pre><code>#Import libraries
  import os
  import pandas as pd
  import requests
  import matplotlib.pyplot as plt
  import numpy as np
  from datetime import date
  import matplotlib.ticker as ticker
      
  # API Key from EIA
  api_key = 'blah blah'
  # api_key = os.getenv(&quot;EIA_API_KEY&quot;)
      
  # PADD Names to Label Columns
  # Change to whatever column labels you want to use.
  PADD_NAMES = ['PADD 1','PADD 2','PADD 3','PADD 4','PADD 5']
  # Enter all your Series IDs here separated by commas
  PADD_KEY = ['PET.MCRRIP12.M',
  'PET.MCRRIP22.M',
  'PET.MCRRIP32.M',
  'PET.MCRRIP42.M',
  'PET.MCRRIP52.M']
      
  # Initialize list - this is the final list that you will store all the data from the json pull. Then you will use this list to concat into a pandas dataframe. 
  final_data = []
  # Choose start and end dates
  startDate = '2009-01-01'
  endDate = '2021-01-01'
      
  # Pull in data via EIA API
  for i in range(len(PADD_KEY)):
      url = 'http://api.eia.gov/series/?api_key=' + api_key + PADD_KEY[i]
      r = requests.get(url)
      json_data = r.json()
          
      if r.status_code == 200:
          print('Success!')
      else:
          print('Error')
          
      df = pd.DataFrame(json_data.get('series')[0].get('data'),
                          columns = ['Date', PADD_NAMES[i]])
      df.set_index('Date', drop=True, inplace=True)
      final_data.append(df)
  </code></pre>
  <p>Here is my error:</p>
  <pre><code>    TypeError                                 Traceback (most recent call last)
      &lt;ipython-input-38-4de082165a0d&gt; in &lt;module&gt;
           10         print('Error')
           11 
      ---&gt; 12     df = pd.DataFrame(json_data.get('series')[0].get('data'),
           13                       columns = ['Date', PADD_NAMES[i]])
           14     df.set_index('Date', drop=True, inplace=True)
      
      TypeError: 'NoneType' object is not subscriptable
  </code></pre>