from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config:
CLIENTID = "1000.XXXXX";
CLIENTSECRET = "XXXXX";
REFRESHTOKEN = "1000.XXXXX.XXXX";
ORGID = "XXXXX";
WORKSPACEID = "XXXXX";
VIEWID = "XXXXX";
class sample():
ac = AnalyticsClient(Config.CLIENTID, Config.CLIENTSECRET, Config.REFRESHTOKEN)
def import_data(self, ac):
import_type = "append"
file_type = "csv"
auto_identify = "true"
onError = "setcolumnempty"
skipTop = 1
thousandSeperator = 0
dateFormt = "yyyy-MM-dd HH:mm:ss"
columnDateFormat = {"Date":"yyyy-MM-dd HH:mm:ss"}
file_path = "/PATH/TO/FILE/"
bulk = ac.get_bulk_instance(Config.ORGID, Config.WORKSPACEID)
result = bulk.import_data(Config.VIEWID, import_type, file_type, auto_identify, file_path)
print(result)
try:
obj = sample()
obj.import_data(obj.ac);
except Exception as e:
print(str(e))