【发布时间】:2019-10-27 10:49:21
【问题描述】:
我正在尝试通过 Zoho 客户端库连接 Zoho Analytics 和 Python:https://www.zoho.com/analytics/api/#python-library
我下载了客户端库文件,但现在不知道如何使用它。我想做的是将数据从 Zoho Analytics 导入 Python,Zoho 上的建议代码是:
from __future__ import with_statement
from ReportClient import ReportClient
import sys
from __future__ import with_statement
from ReportClient import ReportClient
import sys
class Sample:
LOGINEMAILID="abc@zoho.com"
AUTHTOKEN="************"
DATABASENAME="Workspace Name"
TABLENAME="Table Name"
rc = None
rc = ReportClient(self.AUTHTOKEN)
def importData(self,rc):
uri = rc.getURI(self.LOGINEMAILID,self.DATABASENAME,self.TABLENAME)
try:
with open('StoreSales.csv', 'r') as f:
importContent = f.read()
except Exception,e:
print "Error Check if file StoreSales.csv exists in
the current directory"
print "(" + str(e) + ")"
return
impResult = rc.importData(uri,"APPEND",importContent,None)
print "Added Rows :" +str(impResult.successRowCount) + " and Columns :"
+ str(impResult.selectedColCount)
obj = Sample()
obj.importData(obj.rc)
如何使from ReportClient import ReportClient 工作?
另外,如果 self 没有预定义,rc = ReportClient(self.AUTHTOKEN) 如何工作?
【问题讨论】:
-
您遇到什么错误?你提到你想让
from ReportClient import ReportClient工作,但你没有说它有什么问题。 -
您好,错误是“没有名为 ReportClient 的模块”。我应该在哪里存储客户端库文件夹?
标签: python api python-2.x zoho