为什么list_companies()不返回我在Google Cloud Talent Solution中创建的公司?

时间:2019-06-17 14:08:28

标签: python google-cloud-talent-solution

我有:

from google.cloud import talent_v4beta1
CLIENT = talent_v4beta1.CompanyServiceClient()
PROJECT_ID = '...'
PROJECT_PATH = 'projects/{}'.format(PROJECT_ID)

company = {
    'display_name' : ...,
    'external_id' : ...
}

# this call successful creates a new company
CLIENT.create_company(PROJECT_PATH, company)

# this call doesn't return any companies
CLIENT.list_companies(PROJECT_PATH)

当我使用Google API Explorer尝试list_companies时,它会成功返回我创建的公司。

如果我尝试从我的项目中再次使用相同的CLIENT.create_company(PROJECT_PATH, company)格再次调用company,则会成功引发exceptions.AlreadyExists

失误在哪里?

1 个答案:

答案 0 :(得分:1)

您是否尝试过遍历内容并检查?

for ele in CLIENT.list_companies(PROJECT_PATH):
    print(ele)