0

对于我添加的 Python 文件:

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

所有三行都被 pylint 接受。但是当我尝试导入 JobView 和/或 SearchMode 时,运行会产生 ImportError。

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

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

我也尝试search_mode过,但 pylint 抱怨,ImportError如果我尝试运行代码,我可以。

最终,这些值映射到字符串,所以我可以很简单地添加"JOB_SEARCH""JOB_VIEW_FULL"但我想使用谷歌的 API,因为它打算使用。我肯定需要访问其他值。

4

1 回答 1

0

在中找到定义\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
于 2019-06-27T13:13:32.150 回答