Reputation: 3581
I have a Google spreadsheet that I want to use read through a Google Python client. This spreadsheet is private. Here is the code:
import gdata
import gdata.docs
import gdata.spreadsheet
import gdata.spreadsheet.service
client = gdata.spreadsheet.service.SpreadsheetsService()
client.email = '[email protected]'
client.password = 'yyyyy'
client.ProgrammaticLogin()
spreadsheet_feed = client.GetFeed('http://spreadsheets.google.com/feeds/spreadsheets/private/full')
first_entry = spreadsheet_feed.entry[0]
key = first_entry.id.text.rsplit('/')[-1]
worksheets_feed = client.GetWorksheetsFeed(key)
for entry in worksheets_feed.entry:
print entry.title.text
This gives me the following error:
client.ProgrammaticLogin()
File "C:\python27\lib\site-packages\gdata\service.py", line 793, in ProgrammaticLogin
raise BadAuthentication, 'Incorrect username or password'
gdata.service.BadAuthentication: Incorrect username or password
Why is it that even though the username/pass are correct and the username is in the company domain but on Google servers?
Upvotes: 2
Views: 1393
Reputation: 13960
You can enable an "app specific password" for your program. This is a password that is used only from the program that you are working on. Google's instructions are here: https://support.google.com/accounts/answer/185833?rd=1, but the gist is that you should go to https://security.google.com/settings/security/apppasswords and create a new password.
Upvotes: 1
Reputation: 390
The problem you are facing is because of google security protocol. Google doesn't allow any less secure app to connect to your account and these gdata api uses less security measures so if you want to connect to your account using these api's you have to enable to access your account for less secure apps. Go to this link: https://www.google.com/settings/security/lesssecureapps
Upvotes: 1