8000 Update Google Spreadsheets example by russfeld · Pull Request #115 · adafruit/Adafruit_Python_DHT · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Update Google Spreadsheets example #115

Merged
merged 2 commits into from
Jun 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/google_spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
def login_open_sheet(oauth_key_file, spreadsheet):
"""Connect to Google Docs spreadsheet and return the first worksheet."""
try:
scope = ['https://spreadsheets.google.com/feeds']
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name(oauth_key_file, scope)
gc = gspread.authorize(credentials)
worksheet = gc.open(spreadsheet).sheet1
Expand Down Expand Up @@ -115,7 +115,7 @@ def login_open_sheet(oauth_key_file, spreadsheet):

# Append the data in the spreadsheet, including a timestamp
try:
worksheet.append_row((datetime.datetime.now(), temp, humidity))
worksheet.append_row((datetime.datetime.now().isoformat(), temp, humidity))
except:
# Error appending data, most likely because credentials are stale.
# Null out the worksheet so a login is performed at the top of the loop.
Expand Down
0