libgmail failure

james.p.news at gmail.com james.p.news at gmail.com
Thu Aug 23 03:41:33 CEST 2007


On Aug 22, 4:11 pm, James Stroud <jstr... at mbi.ucla.edu> wrote:
> james.p.n... at gmail.com wrote:
> > On Aug 22, 10:26 am, James Stroud <jstr... at mbi.ucla.edu> wrote:
> >> 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




More information about the Python-list mailing list