Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_user_credentials_loading(self):
c = pygsheets.authorize(client_secret=self.base_path + '/client_secret.json',
credentials_directory=self.base_path)
assert isinstance(c, Client)
self.sheet = c.create('test_sheet')
self.sheet.share('pygsheettest@gmail.com')
self.sheet.delete()
def test_service_account_authorization(self):
c = pygsheets.authorize(service_account_file=self.base_path + '/pygsheettest_service_account.json')
assert isinstance(c, Client)
self.sheet = c.create('test_sheet')
self.sheet.share('pygsheettest@gmail.com')
self.sheet.delete()
http = kwargs.get('http', None)
check = kwargs.get('check', True)
if custom_credentials is not None:
credentials = custom_credentials
elif service_account_env_var is not None:
service_account_info = json.loads(os.environ[service_account_env_var])
credentials = service_account.Credentials.from_service_account_info(
service_account_info, scopes=scopes)
elif service_account_file is not None:
credentials = service_account.Credentials.from_service_account_file(service_account_file, scopes=scopes)
else:
credentials = _get_user_authentication_credentials(client_secret, scopes, credentials_directory, local)
return Client(credentials, http=http, check=check)