Belvi Nosakhare
Belvi Nosakhare

Reputation: 3255

Authorization error on gdata Spreadsheet

Was using gdata to update a spreadsheet file on my drive using python on appengine. Everything works fine until recently, the code started encountering error.

    import webapp2
import gdata.spreadsheet.text_db
from google.appengine.api import mail


client = gdata.spreadsheet.text_db.DatabaseClient(username='[email protected]', 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'}

Initially thought it was the restriction on the file but i have made it open and it still didn't work. How can i fix this .

Upvotes: 1

Views: 1543

Answers (1)

Belvi Nosakhare
Belvi Nosakhare

Reputation: 3255

Google stopped allowing such method of authentication. Developers have to create credentials on google console. see this for more help and if you are using Google Data Protocol for to access help use spreadsheet as db like i was trying to do, This should also be of help.

Upvotes: 2

Related Questions