def get_google_service(service_type=None,version=None):
'''
get_google service will use the requests library to get a url
:param service_type: the service to get (default is storage)
:param version: version to use (default is v1)
'''
if service_type == None:
service_type = "sheets"
if version == None:
version = "v4"
secrets=os.environ.get('GOOGLE_SHEETS_CREDENTIALS')
if secrets is not None:
return get_authenticated_service(secrets, service_type, version)
credentials = GoogleCredentials.get_application_default()
return discovery.build(service_type, version, credentials=credentials)
评论列表
文章目录