我正在尝试通过Zoho客户端库连接Zoho分析和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)
是如何工作的?你知道吗
在链接的站点上,可以下载包含文件
Zoho/ZohoReportPythonClient/com/adventnet/zoho/client/report/python/ReportClient.py
的zip文件。我不知道为什么它嵌套得这么深,或者为什么大多数文件夹都包含一个__init__.py
文件,而其中只有#$Id$
。你知道吗您需要提取该文件,并将其放置在Python解释器可以找到它的地方。有关Python将在何处查找模块的更多信息(报表客户端.py),请看这个问题:How does python find a module file if the import statement only contains the filename?
请注意,该文件是python2代码。您需要使用python2解释器,或者将其转换为python3代码。一旦正确导入了它,就可以使用它们的API引用开始编写代码:https://css.zohostatic.com/db/api/v7_m2/docs/python/
相关问题 更多 >
编程相关推荐