我是Salesforce和Python的新手,并且在解决这个问题时遇到了一些麻烦,非常感谢任何帮助。
from simple_salesforce import Salesforce
import requests
import csv
import json
import pdb
sf = Salesforce(
username='jXXXXXXXXXX@gmail.com', password='XXXXXX', security_token='security_token')
accDetails = sf.query("SELECT Name FROM Account")
#print(accDetails)
try:
#pdb.set_trace()
decoded = json.loads(accDetails)
# Pretty printing of json-formatted string
print json.dumps(decoded, sort_keys=True, indent=4)
print "JSON decoded: ", decoded['two']['list'][1]['item']
except (ValueError, KeyError, TypeError):
print "JSON format error"
它抛出" JSON格式错误"错误。我确定它很简单,我做错了,正如我所说,我对此非常陌生。