Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复';simple#u salesforce.exceptions.SalesforceResourceNotFound';描述对象线索时出现的错误?_Python_Pyspark_Salesforce_Restful Authentication_Simple Salesforce - Fatal编程技术网

Python 如何修复';simple#u salesforce.exceptions.SalesforceResourceNotFound';描述对象线索时出现的错误?

Python 如何修复';simple#u salesforce.exceptions.SalesforceResourceNotFound';描述对象线索时出现的错误?,python,pyspark,salesforce,restful-authentication,simple-salesforce,Python,Pyspark,Salesforce,Restful Authentication,Simple Salesforce,我使用simple_salesforce API客户端从pyspark shell连接到salesforce,以便查询对象列表。 当我试图描述对象以查找可用列列表时,我得到了以下错误: simple_salesforce.exceptions.SalesforceResourceNotFound:未找到资源源_表。响应内容:[{u'errorCode':u'NOT_FOUND',u'message':u'请求的资源不存在'}] 我观察到,当我使用变量名来存储对象(表)名时,我得到了resourc

我使用simple_salesforce API客户端从pyspark shell连接到salesforce,以便查询对象列表。 当我试图描述对象以查找可用列列表时,我得到了以下错误:

simple_salesforce.exceptions.SalesforceResourceNotFound:未找到资源源_表。响应内容:[{u'errorCode':u'NOT_FOUND',u'message':u'请求的资源不存在'}]

我观察到,当我使用变量名来存储对象(表)名时,我得到了resourcenotfound错误。因此,我在desc语句中硬编码了对象,如下所示: desc=sf.Lead.desc() 现在这是工作

但是我想要一个可行的解决方案,在这个方案中,我可以在运行时提供对象名,或者在我的例子中,我有一个对象列表。每次我都要绕过去描述它们

    sf = Salesforce(username='xxxxxxx', password='yyyyyy', 
         security_token='')
    source_table = "Lead"
    desc = sf.source_table.describe()

我希望语句能够正确执行,但它抛出了一个错误。

simple\u salesforce
的连接对象(
sf
此处)具有表示每个可用sObject的合成属性。要使用表名动态地获取此信息,必须使用
getattr()
。否则,您将引用一个属性
sf.source\u table
,该属性不存在-没有名为
source\u table
的sObject

所以你可以

sf.Lead.describe()


simple\u salesforce
的连接对象(
sf
此处)具有表示每个可用sObject的合成属性。要使用表名动态地获取此信息,必须使用
getattr()
。否则,您将引用一个属性
sf.source\u table
,该属性不存在-没有名为
source\u table
的sObject

所以你可以

sf.Lead.describe()


非常感谢@david getattr很好地满足了我的需要非常感谢@david getattr很好地满足了我的需要