How to use the pygsheets.client.Client function in pygsheets

To help you get started, we’ve selected a few pygsheets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nithinmurali / pygsheets / test / authorization_tests.py View on Github external
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()
github nithinmurali / pygsheets / test / authorization_tests.py View on Github external
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()
github nithinmurali / pygsheets / pygsheets / authorization.py View on Github external
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)