why doesn't list_companies() return the companies I created in Google cloud Talent Solution?

63 Views Asked by At

I have:

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)

When I use the Google API Explorer to try out list_companies it successfully returns the companies I have created.

If I try to again call CLIENT.create_company(PROJECT_PATH, company) with the same company dict from my project it successfully throws exceptions.AlreadyExists

Where's the misstep?

1

There are 1 best solutions below

1
AlanK On BEST ANSWER

Have you tried looping over the contents and checking?

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