title: AttributeError: 'list' object has no attribute 'get' when I try running my API request in python
body: <pre><code>from urllib.request import urlopen
  import time
  import json
  import csv
  
  
  
  csvFile = open("C:/Users/Macy/Desktop/Scripts/test.csv", 'w+', newline='')
  writer = csv.writer(csvFile)
  writer.writerow(('City', 'Name', 'Age','Sex','Race'))
  
  STAGGER_TIME = 1 # of seconds
  CityList = ('Canton')
  
  
  for city in CityList:
      response = urlopen("https://thecountedapi.com/api/counted/?state=TX&amp;city="+city).read().decode('utf-8')
      responseJson = json.loads(response)
      print("--------------")
      print("City: " + str(responseJson.get("city")))
      print("Name: " + str(responseJson.get("name")))
      print("Age: " + str(responseJson.get("age")))
      print("Sex: " + str(responseJson.get("sex")))
      print("Race: " + str(responseJson.get("race")))
      writer.writerow((responseJson.get("name"), responseJson.get("age"), responseJson.get("sex"), responseJson.get("race"), responseJson.get("city")))
      time.sleep(STAGGER_TIME)
  
  csvFile.close()
  </code></pre>
  
  <p>This is the code that I'm trying to run in Python. Everytime I try running this code, I get an error stating:</p>
  
  <pre><code>"Traceback (most recent call last):
    File "C:/Users/Macy/Desktop/Texas A&amp;M/Junior Year/Fall Semester/ISYS 281/shooting.py", line 20, in &lt;module&gt;
      print("City: " + str(responseJson.get("city")))
  AttributeError: 'list' object has no attribute 'get'
  </code></pre>
  
  <p>Where am I going wrong in this code? I've tried researching the problem but all the sources I find are confusing to me.</p>
  
  <pre><code>from urllib.request import urlopen
  import time
  import json
  import csv
  
  
  
  csvFile = open("C:/Users/Macy/Desktop/Scripts/test.csv", 'w+', newline='')
  writer = csv.writer(csvFile)
  writer.writerow(('City', 'Name', 'Age','Sex','Race'))
  
  
  
  CityList = ('Canton')
  
  
  for city in CityList:
      response = urlopen("https://thecountedapi.com/api/counted/?state=TX&amp;city="+city).read().decode('utf-8')
      responseJson = json.loads(response)[0]
      print("--------------")
      print("City: " + responseJson.get["city"])
      print("Name: " + (responseJson.get["name"])
      print("Age: " + (responseJson.get["age"])
      print("Sex: " + (responseJson.get["sex"])
      print("Race: " + (responseJson.get ["race"])
      writer.writerow((responseJson.get["name"], responseJson.get["age"], responseJson.get["sex"], responseJson.get["race"], responseJson.get["city"]))
  
  
  
  csvFile.close() 
  </code></pre>
  
  <p>This is some updated code but I'm still getting an invalid syntax error when I run the code.</p>