def create_connection_from_config(): """ Returns Google API client for Compute. It detects credentials for Service accounts and User accounts. """ credentials = ServiceAccountCredentials.get_application_default() return googleapiclient.discovery.build('compute', 'v1', credentials=credentials)
def __init__(self): # Initialize the API client. self.__service = discovery.build( serviceName='sheets', version='v4', credentials=ServiceAccountCredentials.get_application_default(), cache_discovery=False)