I am trying to import data from an API and later export it into a CSV file. However this it not working and I'm getting the following error:
expected string or buffer. 
I even tried using json.dumps instead of json.load, I get the following error: 
<response 200 is not json serializable. 
Sample code:
import requests
from requests.auth import HTTPBasicAuth
import pandas as pd
import json
import csv
proxies = {
    'http': 'http://dummy.restapiexample.com/api/v1/employees
    'https': 'http://dummy.restapiexample.com/api/v1/employees
}
url = 'http://dummy.restapiexample.com/api/v1/employees' 
r = s.get(url=url, proxies=proxies,  auth=HTTPBasicAuth('user', 'pass'))
employee_parsed = json.loads(r) 
emp_data = employee_parsed['Employee ID']
employ_data = open('"Path" testname.csv', 'w') 
csvwriter = csv.writer(employ_data)
count = 0
for emp in emp_data:
      if count == 0:
             header = emp.keys()
             csvwriter.writerow(header)
             count += 1
      csvwriter.writerow(emp.values())
employ_data.close()
Does anyone have an idea how I can solve the errors occurring? Any tips would be appreciated or any insight or where to look/think. Thanks!
 
     
     
     
    