gspread.v4.exceptions.APIError - UNAUTHENTICATED
See original GitHub issuePython version: 3.6 gspread version: 2.0.0
Honestly I don’t know what happened. One day it was working and the next day (today) authentication is failing.
Code
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name(
"client-secret.json",
scope
)
client = gspread.authorize(creds)
spreadsheet_key = "28934823459U24IR904RUI0924UR02834UR"
sheet = client.open_by_key(spreadsheet_key).worksheet("Log")
Error
2018-04-03T09:40:08.062563+00:00 app[web.1]: gspread.v4.exceptions.APIError: {
2018-04-03T09:40:08.062565+00:00 app[web.1]: "error": {
2018-04-03T09:40:08.062566+00:00 app[web.1]: "code": 401,
2018-04-03T09:40:08.062572+00:00 app[web.1]: "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
2018-04-03T09:40:08.062573+00:00 app[web.1]: "status": "UNAUTHENTICATED"
2018-04-03T09:40:08.062574+00:00 app[web.1]: }
2018-04-03T09:40:08.062576+00:00 app[web.1]: }
I checked issue #512 but I already had the right scope from the very start.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
Developers - gspread.v4.exceptions.APIError - UNAUTHENTICATED -
Python version: 3.6 gspread version: 2.0.0. Honestly I don't know what happened. One day it was working and the next day (today) authentication...
Read more >python3 gspread exception not caught - Stack Overflow
exceptions.APIError as UNAUTHENTICATED: print("Api error occurred for gspread due to authentication failure while writing What ever value.").
Read more >Exceptions — gspread 5.7.0 documentation
Trying to open non-existent or inaccessible spreadsheet. exception gspread.exceptions.UnSupportedExportFormat¶. Raised when export format is ...
Read more >[Example code]-python3 gspread exception not caught
I have the following piece of code which attempts to capture a gspread.exceptions.APIError, usually as the result of a timeout of the Google...
Read more >"Exceeds grid limits" error when batch updating a Spreadsheet
Either email addresses are anonymous for this group or you need the view member ... Nov 22, 2016, 4:45:33 AM11/22/16 ... Dec 30,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why was this issue closed without a solution?
Hi, I think this will help you. https://stackoverflow.com/questions/45914349/python-gspread-request-error-401
The access_token have a lifetime so you have to do a simple
gc.login()