def get_google_api_service(service_name, service_version, scopes):
'''Use Google Client API to get a Google API Service.
:param service_name: the name of requested service, e.g. 'sheets'
:param service_version: the version of requested service, e.g. 'v4'
:param scopes: the authentication requested.
:return: googleapiclient.discovery.Resource Object, tied to google
service API.
'''
try:
return discovery.build(
service_name,
service_version,
http=get_authorized_http_object(scopes)
)
except AttributeError: # config variables are missing
# todo: write as real exception
raise
评论列表
文章目录