【问题标题】:AttributeError: 'module' object has no attribute 'login'AttributeError:“模块”对象没有属性“登录”
【发布时间】:2023-04-15 07:36:01
【问题描述】:
import gspread  
gc = gspread.login(‘the.email.address@gmail.com’,’password’)  

AttributeError: 'module' 对象没有属性 'login'

【问题讨论】:

  • 什么是 gspread?是什么让您认为它具有“登录”属性?如果是this,则不是。
  • 下次好好看看documentation!!,gspread显然没有登录方法可能你要找的是authorize()方法
  • 但我使用的是 Python 2.7
  • @Gizvo:如果您使用过时的文档,您应该使用过时版本的包。更好的办法是使用当前版本的包并使用最新的文档。

标签: python gspread


【解决方案1】:

我知道的gsspread没有login方法!

我猜你要找的是authorize

你最好这样做:

import gspread
gc = gspread.authorize(credentials) # check link below on how to obtain the credentials

gsspread 详细记录了如何获取credentials 的过程 - http://gspread.readthedocs.io/en/latest/oauth2.html

【讨论】: