Gspread(name: str, environ_prefix: str, credentials: str)¶
Google spreadsheet handler.
- name (str) – name of spreadsheet to connect to
- environ_prefix (str) – prefix of environment variables containing valid credits
- credentials (dict) – path to json containing credentials
- credentials – valid credentials to manipulate a spreadsheet through the API
- name – attribute to store argument
- sheets – stores the worksheets opened with
self.open_worksheet()as a dict, with the worksheet’s title as key
Environment variables need to have the form
PROJECT_ID PRIVATE_KEY_ID PRIVATE_KEY CLIENT_ID CLIENT_EMAIL CLIENT_X509_CERT_URL
append_row(worksheet: str, item: list)¶
Append a row to a worksheet.
The method returns
selfso that calls to
append_rowcan be chained.
- worksheet (str) – worksheet to append row to
- item (list) – values to append
delete_records(worksheet: str, rows: int = 1)¶
Delete records by resizing a worksheet.
get_credentials(prefix: str, file: str)¶
Read private keys from environ and update json credentials
Open a worksheet and store it in
read_records(worksheet: str) → list¶
Return records from a worksheet.
The method skips the header row.
NetworkWait(delay: int = 10, hostname: str = 'www.google.com')¶
Wait (infinitely) for an internet connexion.
- delay (int) – seconds between each ping trial
- hostname (str) – default
www.google.com: the hostname to ping
connected – indicates that a connexion was found
ping(hostname: str) → bool¶
Ping the hostname to see if an internet connexion is available.
stubborn_ping(delay: int, hostname: str) → None¶
delayseconds until a connexion is found.