我正在尝试从sugarcrm收集数据并使用以下代码:
import sugarcrm
sugarcrm_user = "user"
sugarcrm_pass = "pass"
sugarcrm_url = "url/service/v4/rest.php"
sugarcrm_conn= None
try:
sugarcrm_conn = sugarcrm.Sugarcrm(url = sugarcrm_url, username = sugarcrm_user, password =
sugarcrm_pass)
accounts = sugarcrm_conn.module('Accounts')
except ValueError:
print "cann't connect to " + sugarcrm_url
exit(1)
连接工作正常,但当我尝试使用sugarcrm对象时说
Sugarcrm实例没有属性'模块'
答案 0 :(得分:0)
使用this link部分#1.b - 方法2:使用纯JSON 是一个很好的选择:
filtered_accounts = sugarcrm_conn.get_entry_list('Accounts', 'accounts.name like "%batman%"', 'accounts.name DESC', 0, ['name','date_entered','email1']) #here offset is 0
print filtered_accounts
for account in filtered_accounts['entry_list']:
name_value_list = account['name_value_list']
print "name=%s,email=%s" % (name_value_list['name']['value'],name_value_list['email1']['value'])