[Colab] TypeError: Credentials need to be from either oauth2client or from google-auth.


1. Error 내용

/usr/local/lib/python3.7/dist-packages/gspread/utils.py in convert_credentials(credentials)
     59 
     60     raise TypeError(
---> 61         'Credentials need to be from either oauth2client or from google-auth.'
     62     )
     63 
 

TypeError: Credentials need to be from either oauth2client or from google-auth. 


2. 해결방안

# as-is

# gauth.credentials = GoogleCredentials.get_application_default()# gc = gspread.authorize(gauth.credentials)



# to-be
from google.auth import default 
# creds, _ = default()
# gc = gspread.authorize(creds)


<참고>

https://colab.research.google.com/notebooks/snippets/sheets.ipynb

https://github.com/burnash/gspread/issues/1014

댓글

이 블로그의 인기 게시물

[Eclipse] publishes and runs j2ee and java ee web projects and server configurations to a local tomcat server