使用gdata在appengine上使用python更新驱动器上的电子表格文件。一切正常,直到最近,代码开始遇到错误。
import webapp2
import gdata.spreadsheet.text_db
from google.appengine.api import mail
client = gdata.spreadsheet.text_db.DatabaseClient(username='mail@gmail.com', password='passsword')
class createSurvey(webapp2.RequestHandler):
def get(self):
db = client.CreateDatabase("Project")// this line started to show the error below.
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
db = client.CreateDatabase("Project")
File "C:\Python27\lib\gdata\spreadsheet\text_db.py", line 146, in CreateDatabase
db_entry = self.__docs_client.UploadSpreadsheet(virtual_media_source, name)
File "C:\Python27\lib\atom\__init__.py", line 1475, in deprecated_function
return f(*args, **kwargs)
File "C:\Python27\lib\gdata\docs\service.py", line 466, in UploadSpreadsheet
folder_or_uri=folder_or_uri)
File "C:\Python27\lib\gdata\docs\service.py", line 161, in _UploadFile
converter=gdata.docs.DocumentListEntryFromString)
File "C:\Python27\lib\gdata\service.py", line 1236, in Post
media_source=media_source, converter=converter)
File "C:\Python27\lib\gdata\service.py", line 1358, in PostOrPut
'reason': server_response.reason, 'body': result_body}
RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Authorization required</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Authorization required'}
最初认为这是对文件的限制,但我已将其打开,但仍然无法正常工作。我怎样才能解决这个问题 。
答案 0 :(得分:2)
Google停止了这种身份验证方法。开发人员必须在Google控制台上创建凭据。 see this for more help如果您使用Google数据协议来访问帮助,请使用电子表格作为我想要做的数据库,This也应该有所帮助。