title: Python MySQL IndexError: list index out of range
body: <p>Getting an <code>IndexError: list index out of range Error</code>. New to Python, complete beginner and would appreciate some help to understand whats wrong. </p>
  
  <p>Getting json from a timesheet api which i need to save to a mysql database</p>
  
  <pre><code>import requests
  import urllib2
  from urllib2 import urlopen
  import json 
  import mysql.connector
  
  site = 'https://api.site.com/Projects/?version=5'
  hdr = {'Authorization': 'WRAP access_token="TOKEN"', 'Accept': 'application/json'}
  
  req = urllib2.Request(site, headers=hdr)
  try:
       page = urllib2.urlopen(req)
  except urllib2.HTTPError, e:
       print e.fp.read()
  
  response = urllib2.urlopen(req).read()
  json_obj = json.loads(response.decode ('utf8'))
  
  conn = mysql.connector.connect(host = "HOST_IP",
                     user = "USER",
                     passwd = "PASS",
                     db = "DB",
                     port=3306,
                     collation="utf8mb4_unicode_ci")
  
  cursor = conn.cursor ()
  
  for Project in json_obj["Projects"]:
       cursor.execute("""
              INSERT INTO project 
                  (ID, Client_Name, Name, BusSector, ProjCat, SageCode)
              VALUES 
                  (%s, %s, %s, %s, %s, %s) 
              ON DUPLICATE KEY UPDATE
                 Name = VALUES(Client_Name),
                 Name = VALUES(Name),
                  Name = VALUES(BusSector),
                  Name = VALUES(ProjCat),
                  Name = VALUES(SageCode);
                         """,(Project["ID"],Project["Client"]["Name"],Project["Name"],Project["CustomFields"][0]["Values"][0],Project["CustomFields"][2]["Values"][0],Project["CustomFields"][1]["Values"][0])     
                        )
  conn.commit()
  cursor.close()
  conn.close() 
  </code></pre>
  
  <p>The output from Traceback is:</p>
  
  <pre><code>line 52, in &lt;module&gt;  """,(Project["ID"],Project["Client"]["Name"],Project["Name"],Project["CustomFields"][0]["Values"][0],Project["CustomFields"][2]["Values"][0],Project["CustomFields"][1]["Values"][0])
  </code></pre>