获取Salesforce数据的Python Salesforce库?
有没有什么库或者工具可以让我们用Python连接到Salesforce并获取数据呢?
5 个回答
1
在我看来,这个是最好的: http://code.google.com/p/salesforce-python-toolkit/
8
还有一个叫做 simple_salesforce 的工具包。
你可以用下面的命令来安装它:
$ pip install simple_salesforce
你可以用以下方式访问你的Salesforce账户:
from simple_salesforce import Salesforce
sf = Salesforce(username='youremail@abc.com', password='password', security_token='token')
这个工具包的说明文档里有很多有用的细节...
18
我在用beatbox这个工具。
下面是一个通过电子邮件地址查询潜在客户的例子。
import beatbox
sf_username = "Username"
sf_password = "password"
sf_api_token = "api token"
def get_lead_records_by_email(email)
sf_client = beatbox.PythonClient()
password = str("%s%s" % (sf_password, sf_api_token))
sf_client.login(sf_username, password)
lead_qry = "SELECT id, Email, FirstName, LastName, OwnerId FROM Lead WHERE Email = '%s'" % (email)
records = sf_client.query(lead_qry)
return records
如果想获取其他数据,可以查看Salesforce的API文档。
想看更多beatbox的例子,可以点击这里。