WebFaction
Community site: login faq

I am trying to run a simple script using the gdata-python-client from the Google Data APIs Python Client Library. The script runs fine on the command line on my windows PC. However, when I try to run it here in webfaction I get the following error:

File "/home/webfaction_username/lib/python2.7/gdata/service.py", line 834, in ClientLogin
    self.ProgrammaticLogin(captcha_token, captcha_response)
  File "/home/webfaction_username/lib/python2.7/gdata/service.py", line 793, in ProgrammaticLogin
    raise BadAuthentication, 'Incorrect username or password'
gdata.service.BadAuthentication: Incorrect username or password

I'm using python2.7 and gdata-2.0.18. I can manually log into gmail with the username and password that I am using in the script. Is there something additional I need to configure to make this work?

Here is my code:

#!/usr/bin/python
import gdata.docs.service

# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.docs.service.DocsService()
# Authenticate using your Google Docs email address and password.
client.ClientLogin('email', 'password')
#    username => 'email',
#    password => 'password'

# Query the server for an Atom feed containing a list of your documents.
documents_feed = client.GetDocumentListFeed()
# Loop through the feed and extract each document entry.
for document_entry in documents_feed.entry:
# Display the title of the document on the command line.
print document_entry.title.text

asked 17 Jul '14, 03:05

ksiadmin
1113
accept rate: 0%

edited 22 Jul '14, 15:32

I meant to say I am not using 2-factor authentication, as that is the only issue that seems to come up on a google search. But I am not using it, I'm using the basic programmatic login. User name and password work on multiple other systems (my Windows 7 PC, Amazon EC2 running Ubuntu12). Wondering if it would help if I do set up 2-factor authentication, or if that would only make things worse...

(18 Jul '14, 12:25) ksiadmin

Does the basic gdata Hello World example work for you on our servers?

(18 Jul '14, 21:09) seanf

Thank you for this suggestion. No, the basic gdata Hello World example gives me the same error: ".../gdata/service.py", line 834, in ClientLogin ".../gdata/service.py", line 793, in ProgrammaticLogin gdata.service.BadAuthentication: Incorrect username or password

I am no longer getting the "ProgrammaticLogin(captcha_token, captcha_response)" part of the error. Your first suggestion led me to the https://accounts.google.com/b/0/DisplayUnlockCaptcha - after I did that the Captcha part of the error disappeared. But I still can't seem to log in programmatically.

(22 Jul '14, 01:24) ksiadmin

So, if the ProgrammaticLogin error has been eliminated, then what is the exact error message that you're getting now?

(22 Jul '14, 15:11) seanf

Sorry for the confusion, I'm still getting the Programmatic Login error, just not the Captcha part.

".../gdata/service.py", line 834, in ClientLogin

".../gdata/service.py", line 793, in ProgrammaticLogin

gdata.service.BadAuthentication: Incorrect username or password

(22 Jul '14, 15:19) ksiadmin

Can you please post your code, in its entirety, with the exception of your actual login credentials? If you'd rather not share that here, then feel free to open a support ticket.

(22 Jul '14, 15:29) seanf
showing 5 of 6 show 1 more comments

It sounds to me like you're using 2-factor authentication, and you need to create an app-specific password for your script.

Try going to App passwords in your Google account settings to create an app-specific password for your script, then configure your script to use that instead of your main account password.

Hope that helps!

permanent link

answered 18 Jul '14, 02:07

seanf
12.2k41836
accept rate: 37%

The solution for me was to unlock the display captcha, enter to the following URL and log in using the same gmail account that you are using for gdata ClientLogin.

Unlock Display Captcha

I take it from: Link

Hope this helps

permanent link

answered 27 Jul '14, 00:47

egatjens
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×52
×39

question asked: 17 Jul '14, 03:05

question was seen: 5,609 times

last updated: 27 Jul '14, 00:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM