'The caller does not have permission' on sheet edit
ThePugi opened this issue · 2 comments
ThePugi commented
Hi there, so I have downloaded and obtained all credential/token files (credentials-sheets.json, token-drive.pickle, token-sheets.pickle). I am able to create a Spreadsheet object with EZSheets but attempting to do sheet['A2'] = 'Greetings!'
returns two exceptions:
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\ezsheets\__init__.py", line 146, in _makeRequest
return request.execute()
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\googleapiclient\_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\googleapiclient\http.py", line 898, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://sheets.googleapis.com/v4/spreadsheets/sheet_ID/values/Sheet1%21A2%3AA2?valueInputOption=USER_ENTERED&alt=json returned "The caller does not have permission">
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\ezsheets\__init__.py", line 1339, in __setitem__
return self.update(key[0], value)
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\ezsheets\__init__.py", line 973, in update
_makeRequest('values.update', **{'spreadsheetId': self._spreadsheet._spreadsheetId,
File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python38\lib\site-packages\ezsheets\__init__.py", line 149, in _makeRequest
if errorContent['error']['errors'][0]['reason'] != 'rateLimitExceeded':
KeyError: 'errors'
asweigart commented
I think the main cause of this error is from the second part:
if errorContent['error']['errors'][0]['reason'] != 'rateLimitExceeded':
This would be caused by making too many requests too frequently. The free google accounts have some rate limiting documented here: https://developers.google.com/analytics/devguides/config/mgmt/v3/limits-quotas