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

To help you get started, we’ve selected a few gspread 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 robin900 / gspread-dataframe / tests / gspread_dataframe_integration.py View on Github external
def setUp(self):
        if self.__class__.gc is None:
            self.__class__.setUpClass()
        self.assertTrue(isinstance(self.gc, gspread.client.Client))
github burnash / gspread / tests / mock_tests.py View on Github external
def setUpClass(cls):
        try:
            cls.config = ConfigParser.RawConfigParser()
            cls.gc = gspread.client.Client(auth={})
        except IOError as e:
            msg = "Can't find %s for reading test configuration. "
            raise Exception(msg % e.filename)
github aiguofer / gspread-pandas / gspread_pandas / client.py View on Github external
from gspread.models import Spreadsheet
from gspread.utils import finditem
from past.builtins import basestring

from gspread_pandas.conf import default_scope, get_creds
from gspread_pandas.util import (
    add_paths,
    convert_credentials,
    folders_to_create,
    remove_keys_from_list,
)

__all__ = ["Client"]


class Client(ClientV4):
    """
    The gspread_pandas :class:`Client` extends :class:`Client `
    and authenticates using credentials stored in ``gspread_pandas`` config.

    This class also adds a few convenience methods to explore the user's google drive
    for spreadsheets.

    Parameters
    ----------
    user : str
        optional, string indicating the key to a users credentials,
        which will be stored in a file (by default they will be stored in
        ``~/.config/gspread_pandas/creds/`` but can be modified with
        ``creds_dir`` property in config). If using a Service Account, this
        will be ignored. (default "default")
    config : dict
github aiguofer / gspread-pandas / gspread_pandas / util.py View on Github external
def request(*args, **kwargs):
        try:
            return ClientV4.request(client, *args, **kwargs)
        except APIError as e:
            error = str(e)
            # Only retry on 100s quota breaches
            if "RESOURCE_EXHAUSTED" in error and "100s" in error:
                sleep(retry_delay)
                return request(*args, **kwargs)
            else:
                error = e

        if "error" in locals():
            raise error
github burnash / gspread / gspread / __init__.py View on Github external
def authorize(credentials, client_class=Client):
    """Login to Google API using OAuth2 credentials.
    This is a shortcut function which
    instantiates :class:`gspread.client.Client`
    and performs login right away.

    :returns: :class:`gspread.Client` instance.
    """
    client = client_class(auth=credentials)
    client.login()
    return client