Search code examples
pythongdatagoogle-data-apigspread

gspread TypeError: login() takes no arguments (2 given)


I have installed gspread and gdata in my virtual environment using pip. And when I try to login with email and password following the documentation, as shown:

import gspread
gc = gspread.login('[email protected]','password')

It throws this error: TypeError: login() takes no arguments (2 given)

gspread is installed properly which is confirmed by successful execution of line import gspread in the python console. Is there some dependency issue that I am unaware of or anything?


Solution

  • You have to login like this

    c = gspread.Client(auth=('[email protected]', 'qwertypassword'))
    c.login()
    

    source http://burnash.github.io/gspread/#gspread.Client.open