How to import types when using Google Cloud Talent Solution (Python)

84 Views Asked by At

For a Python file I've added:

from google.cloud.talent_v4beta1.types import RequestMetadata
from google.cloud.talent_v4beta1.types import JobView
from google.cloud.talent_v4beta1.types import SearchMode

All three lines are accepted by pylint. But running produces an ImportError when I try to import JobView and/or SearchMode.

ImportError: cannot import name 'SearchMode' from 'google.cloud.talent_v4beta1.types

ImportError: cannot import name 'JobView' from 'google.cloud.talent_v4beta1.types

I've tried search_mode too but pylint complains and I can an ImportError if I try to run the code.

Ultimately, these values map to strings so I can be brittle and simple add "JOB_SEARCH" and "JOB_VIEW_FULL" but I would like to use Google's API as it was intended to be used. And there's bound to be other values I'll need to access.

1

There are 1 best solutions below

0
On

Found the definitions in \google\cloud\talent_v4beta1\gapic\enums.py

from google.cloud.talent_v4beta1 import enums

enums.SearchJobsRequest.SearchMode.JOB_SEARCH
enums.JobView.JOB_VIEW_FULL
enums.CommuteMethod.DRIVING
enums.CommuteMethod.TRANSIT