Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Code:
-------------------------------------------------------------------------------------------------------
def send(TO_LIST,SUBJECT,MESSAGE):
GA = libgmail.GmailAccount("xx****@gmail.com","xxxxxxx" )
try:
print "Logging in"
GA.login()
except libgmail.GmailLoginFailure:
print "\nLogin failed. (Wrong username/password?)"
else:
print "Log in successful.\n"
for RX in TO_LIST:
MSG = libgmail.GmailComposedMessage(RX,SUBJECT,MESSAGE)
if GA.sendMessage(MSG):
print "Message successfully sent to `%s` ." % RX
else:
print "Could not send message."
-------------------------------------------------------------------------------------------------------
Output:
-------------------------------------------------------------------------------------------------------
Logging in
HTTP Error 400: Bad Request
Log in successful.
No messages found
Traceback (most recent call last):
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 58, in <module>
main()
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 55, in main
send(TO_LIST,SUB,MSG)
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 39, in send
if GA.sendMessage(MSG):
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 588, in sendMessage
U_ACTION_TOKEN: self._getActionToken(),
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 563, in _getActionToken
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
KeyError: 'GMAIL_AT'
------------------------------------------------------------------------------------------------------- 10 2222
On 21 Ago, 23:07, "james.p.n...@gmail.com" <james.p.n...@gmail.com>
wrote:
Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Code:
---------------------------------------------------------------------------*----------------------------
def send(TO_LIST,SUBJECT,MESSAGE):
GA = libgmail.GmailAccount("xxx...@gmail.com","xxxxxxx" )
try:
print "Logging in"
GA.login()
except libgmail.GmailLoginFailure:
print "\nLogin failed. (Wrong username/password?)"
else:
print "Log in successful.\n"
for RX in TO_LIST:
MSG = libgmail.GmailComposedMessage(RX,SUBJECT,MESSAGE)
if GA.sendMessage(MSG):
print "Message successfully sent to `%s` ." % RX
else:
print "Could not send message."
---------------------------------------------------------------------------*----------------------------
Output:
---------------------------------------------------------------------------*----------------------------
Logging in
HTTP Error 400: Bad Request
Log in successful.
No messages found
Traceback (most recent call last):
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 58, in <module>
main()
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 55, in main
send(TO_LIST,SUB,MSG)
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 39, in send
if GA.sendMessage(MSG):
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 588, in sendMessage
U_ACTION_TOKEN: self._getActionToken(),
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 563, in _getActionToken
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
KeyError: 'GMAIL_AT'
---------------------------------------------------------------------------*----------------------------
Don't know if it's for the same reason since I can't remember if the
error was the same, but some times ago I had a similar problem.
I used libgmail for copying a lot of mails from a google mail box to
another and I've been "black-listed" after a while for flooding.
After that I wasn't neither able to access my account from browser for
a certain amount of time (one or two days).
Try to do same operation 'manually' (by using a browser try to log-in
by using your account, then send a mail) and see if you're able to do
so.
Thanks for the suggestion. I've tried logging in and sending email
manually and it works just fine.
Thanks though,
James
I met the same problem now, James , do you have resolved this
problem ?
On Aug 22, 5:07 am, "james.p.n...@gmail.com" <james.p.n...@gmail.com>
wrote:
Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Code:
-------------------------------------------------------------------------------------------------------
def send(TO_LIST,SUBJECT,MESSAGE):
GA = libgmail.GmailAccount("xxx...@gmail.com","xxxxxxx" )
try:
print "Logging in"
GA.login()
except libgmail.GmailLoginFailure:
print "\nLogin failed. (Wrong username/password?)"
else:
print "Log in successful.\n"
for RX in TO_LIST:
MSG = libgmail.GmailComposedMessage(RX,SUBJECT,MESSAGE)
if GA.sendMessage(MSG):
print "Message successfully sent to `%s` ." % RX
else:
print "Could not send message."
-------------------------------------------------------------------------------------------------------
Output:
-------------------------------------------------------------------------------------------------------
Logging in
HTTP Error 400: Bad Request
Log in successful.
No messages found
Traceback (most recent call last):
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 58, in <module>
main()
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 55, in main
send(TO_LIST,SUB,MSG)
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 39, in send
if GA.sendMessage(MSG):
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 588, in sendMessage
U_ACTION_TOKEN: self._getActionToken(),
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 563, in _getActionToken
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
KeyError: 'GMAIL_AT'
-------------------------------------------------------------------------------------------------------
ja**********@gmail.com wrote:
Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Have you thought about spoofing explorer? Always spoof explorer.
James
On Aug 22, 10:26 am, James Stroud <jstr...@mbi.ucla.eduwrote:
james.p.n...@gmail.com wrote:
Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Have you thought about spoofing explorer? Always spoof explorer.
James
I have not heard of this. How do you spoof IE for libgmail?
Thanks,
James
On Aug 22, 10:26 am, James Stroud <jstr...@mbi.ucla.eduwrote:
james.p.n...@gmail.com wrote:
Hey all,
I've been using libgmail to send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latest libgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Have you thought about spoofing explorer? Always spoof explorer.
James
I have not heard of this. How do you spoof IE in libgmail?
Thanks much,
James ja**********@gmail.com wrote:
On Aug 22, 10:26 am, James Stroud <jstr...@mbi.ucla.eduwrote:
>Have you thought about spoofing explorer? Always spoof explorer.
James
I have not heard of this. How do you spoof IE in libgmail?
You might have to edit libgmail.py directly and add a header to the
urllib2.Request() call. Here are the relevant lines from some code I
wrote (spoofing netscape it looks like):
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
txheaders = {'User-agent' : user_agent}
req = urllib2.Request(pda, signin_params, txheaders)
See if this doesn't fix you up.
James
On Aug 22, 4:11 pm, James Stroud <jstr...@mbi.ucla.eduwrote:
james.p.n...@gmail.com wrote:
On Aug 22, 10:26 am, James Stroud <jstr...@mbi.ucla.eduwrote:
Have you thought about spoofing explorer? Always spoof explorer.
James
I have not heard of this. How do you spoof IE in libgmail?
You might have to edit libgmail.py directly and add a header to the
urllib2.Request() call. Here are the relevant lines from some code I
wrote (spoofing netscape it looks like):
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
txheaders = {'User-agent' : user_agent}
req = urllib2.Request(pda, signin_params, txheaders)
See if this doesn't fix you up.
James
Well, here's what I tried:
Starting at line 344 of the latest version of libgmail:
-------------------------------------------------------------
#headers = {'Host': 'www.google.com',
# 'User-Agent': 'Mozilla/5.0 (Compatible; libgmail-python)'}
headers = {'Host': 'www.google.com',
'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)'}
req = urllib2.Request(URL_LOGIN, data=data, headers=headers)
-------------------------------------------------------------
I grabbed the header information from IE7's identification at http://www.alanwood.net/demos/browserinfo.html. I got the same
error. Am I doing it wrong, or is it not working? I'm very, very new
to net protocols and such...
Thanks,
James
On Aug 21, 5:07 pm, "james.p.n...@gmail.com" <james.p.n...@gmail.com>
wrote:
Hey all,
I've been usinglibgmailto send out automated notification emails for
my company's nightly regression testing. Last night these emails
started failing, though the python code has not changed. I updated to
the latestlibgmail, but that isn't helping. I've logged in to the
email account directly, and the account is still working fine.
The error I get is "HTTP Error 400: Bad Request" when using
gmailAccount.login(). This doesn't throw an exception, just prints
the error. The code crashes outright when it tries to send mail.
This code has been up and running for several months and just started
failing last night. Does anyone have an idea what's going on?
The code and error follow (fairly short :-)
Thanks much,
James
Code:
-------------------------------------------------------------------------------------------------------
def send(TO_LIST,SUBJECT,MESSAGE):
GA =libgmail.GmailAccount("xxx...@gmail.com","xxxxxxx ")
try:
print "Logging in"
GA.login()
exceptlibgmail.GmailLoginFailure:
print "\nLogin failed. (Wrong username/password?)"
else:
print "Log in successful.\n"
for RX in TO_LIST:
MSG =libgmail.GmailComposedMessage(RX,SUBJECT,MESSAGE)
if GA.sendMessage(MSG):
print "Message successfully sent to `%s` ." % RX
else:
print "Could not send message."
-------------------------------------------------------------------------------------------------------
Output:
-------------------------------------------------------------------------------------------------------
Logging in
HTTP Error 400: Bad Request
Log in successful.
No messages found
Traceback (most recent call last):
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 58, in <module>
main()
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 55, in main
send(TO_LIST,SUB,MSG)
File "C:\projects\physware\testCases\PythonTestScri pts
\SendEmail.py", line 39, in send
if GA.sendMessage(MSG):
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 588, in sendMessage
U_ACTION_TOKEN: self._getActionToken(),
File "C:\projects\physware\testCases\PythonTestScripts\ libgmail.py",
line 563, in _getActionToken
at = self._cookieJar._cookies[ACTION_TOKEN_COOKIE]
KeyError: 'GMAIL_AT'
-------------------------------------------------------------------------------------------------------
I believe I've found a (temporary) fix in this forum thread: http://www.castlecops.com/p984588-HT...g_gknujon.html
Pasted here for posterity;
---
Edit the libgmail.py file.
In the function
def login(self)
change the following text:
Code:
try:
link = re.search(RE_PAGE_REDIRECT, pageData).group(1)
redirectURL = urllib.unquote(link)
to add the extra line:
Code:
try:
link = re.search(RE_PAGE_REDIRECT, pageData).group(1)
redirectURL = urllib.unquote(link)
redirectURL = redirectURL.replace('\\x26','&')
---
Must have been some small change in gmail's redirect that put it off.
Thanks! That worked brilliantly.
-James This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: x2164 |
last post by:
hi all,
Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3
I'm new to Python.
I've compiled Python 2.4 from tar file.
|
by: Damaji Jambhale |
last post by:
COMException: Catostrphic failure
When I added a "dll" reference in the web project.
I was able to instantiate the class OK. But when I tried
to set the properties, it failed with...
|
by: JustaCowboy |
last post by:
Greetings,
I am seeking information related to this subject.
BOL suggests backing up the active transaction log immediately after a
failure, so that the backup can be used in a recovery scenario...
|
by: J. Marshall Latham |
last post by:
I have written an ASP.NET web app in C# that is trying to connect to a
database using OleDb. I put code in a dll that uses another dll to create a
connection object (and open it if requested) to...
|
by: kevincw01 |
last post by:
There doesnt seem to be a reliable support channel for libgmail so i
figured this group might have some people who could help.
I have the latest version(from cvs) of libgmail.py, lgconstants.py...
|
by: Marty Cruise |
last post by:
I successfully deploy my application to 20 domain users. Only one new user
is giving me a problem, although he can access all domain resources.
When he clicks the installation link on the...
|
by: Johan Tibell |
last post by:
I've written a piece of code that uses sockets a lot (I know that
sockets aren't portable C, this is not a question about sockets per
se). Much of my code ended up looking like this:
if...
|
by: wal |
last post by:
How does one attach files to emails using libgmail? The following code
http://pramode.net/articles/lfy/fuse/4.txt
works fine when said files are simple text files, but it failes as soon as
the...
|
by: linuxfreak |
last post by:
hi guys,
just starting out on python and libgmail... any documentation for
libgmail outthere... basically what i want to do is develop an
application to use gmail like and ftp server... should...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |