我正在通过Python库marketo-rest-python使用Marketo
API。我可以创建销售线索,也可以通过以下基本代码对其进行更新:
leads = [{"email":"joe@example.com","firstName":"Joe"},{"email":"jill@example.com","firstName":"Jill"}]
lead = mc.execute(method='create_update_leads', leads=leads, action='createOnly', lookupField='email',
asyncProcessing='false', partitionName='Default')
当我以编程方式创建时,此“领导” JSON对象通过
leads = []
lead = {}
lead['email'] = "joe@example.com"
lead['firstName'] = "Joe"
leads.append(lead)
lead = {}
lead['email'] = "jill@example.com"
lead['firstName'] = "Jill"
leads.append(lead)
json_leads = json.dumps(leads, separators=(',', ':'))
print(json_leads)
然后,Microsoft Azure Databricks中的输出完全相同,但是Marketo系统返回一个609
->无效的JSON。
我的输出看起来像
[{"email":"joe@example.com","firstName":"Joe"},{"email":"jill@example.com","firstName":"Jill"}]
与示例中的完全相同。当我使用示例JSON代码行时,它可以工作,但是我自己生成的JSOn不起作用。
任何人都知道这会是什么?我在Microsoft Azure Databricks中使用Python。
答案 0 :(得分:0)
我相信您无需致电json.dumps
,只需这样做
leads = []
lead = {}
lead['email'] = "joe@example.com"
lead['firstName'] = "Joe"
leads.append(lead)
lead = {}
lead['email'] = "jill@example.com"
lead['firstName'] = "Jill"
leads.append(lead)
lead = mc.execute(method='create_update_leads', leads=leads, action='createOnly',
lookupField='email', asyncProcessing='false', partitionName='Default')