我有:
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
失误在哪里?
答案 0 :(得分:1)
您是否尝试过遍历内容并检查?
for ele in CLIENT.list_companies(PROJECT_PATH):
print(ele)