i'm trying to come up with a python script to smoketest certain functions in Birst after a Monthly INFOR CU Update
or Birst update
result0 - List all spaces
result1 - run a query
result2 - run a report
export_data - get result of result2 back as a csv
where i am getting stuck currently is trying to run the getReportData from a predefined visualizer report and trying to turn it into a csv (i would be okay with a pdf or other source too....but figured csv would be a start) and it's saying the value is None
i have a feeling i am missing something obvious.... but this is my 1st go around trying python and deciphering what API's are avialable from Birst and searching google or the Birst help hasn't provided me the nugget of knowledge i am looking for yet.
so i am hoping someone here has tried to do the same and can tell me where i am falling off the cliff 
my python script
-------------------------------------------------------------
from zeep import Client
from zeep import exceptions
import pandas as pd
import pathlib
import sys
import base64
import time
import json
import csv
import os
#import fsspec
from datetime import date
from pathlib import Path
# url: URL end point, adminUser: Admin user that has all requirements, password: Admin user password.
url = 'login.bws.birst.com/CommandWebservice.asmx
adminUser='mybirstuseridgoeshere'
adminPassword='mybirstpasswordgoeshere'
# creating client.
client = Client(url)
# get the login token.
login_token = client.service.Login(adminUser,adminPassword)
# raise exception if token is not available.
if login_token is None:
raise Exception ("Login Failed")
space_id = 'space id for CSF-Consumer'
result0 = str(client.service.listAllSpaces(login_token))
result1 = str(client.service.executeQueryInSpace(login_token,'SELECT TOP 5 [Vendor.Vendor Name] , [Vendor.Vendor Number] FROM [ALL]',space_id))
result2 = str(client.service.getReportData(login_token,space_id,'/shared/Birst_SmokeTest_Report.viz'))
export_token = client.service.exportReportToCSV(login_token,space_id,'/shared/Birst_SmokeTest_Report.viz.dashlet')
print("Login Token = " + login_token)
print("Export Token = " + export_token)
time.sleep(30)
iscomplete = client.service.isJobComplete(login_token,export_token)
print ("is Job Complete: " + str(iscomplete))
export_data = client.service.getExportData(login_token,export_token)
print(export_data)
#write files with output from API's
#make sure they are not appended to by doing the truncate
file = open("c:/temp/Birst_list_spaces.log","w")
file.truncate()
file.write(result0)
file.close
file = open("c:/temp/Birst_executequery.log","w")
file.truncate()
file.write(result1)
file.close
file = open("c:/temp/Birst_getreportdata.log","w")
file.truncate()
file.write(result2)
file.close
file = open("c:/temp/Birst_exportasCSV.csv","w")
file.truncate()
file.write(export_data)
file.close
# Read in the file contents as text
with open('c:/temp/Birst_list_spaces.log','r') as filename:
invalid_json = filename.read()
# Replace all ' with " to make it a valid JSON
valid_json = invalid_json.replace("'",'"')
# Verify that the JSON is valid now and this doesn't raise an exception
json.loads(valid_json)
# Put into a variable
var_1 = pd.read_json(valid_json)
export_csv = var_1.to_csv(r'c:/temp/Birst_list_spaces.csv', index=None, header=True)
client.service.Logout(login_token)
--------------------------------------------
Output from Debug :
Login Token = 962ADBE4E47C9B42BFAED3EDB6B01267
Export Token = E608D82983DA0E41836A0D9BAC400C1E
is Job Complete: True
None
write() argument must be str, not None
Stack trace:
> File "C:Usersccxz0032source
eposPythonApplication2PythonApplication2PythonApplication2.py", line xx, in <module> (Current frame)
> file.write(export_data)
Loaded '__main__'
Loaded 'runpy'