#!/usr/bin/env python

import libgmail
from time import gmtime, strftime

fp = open('/tmp/python.list', 'w')
ga = libgmail.GmailAccount("[EMAIL PROTECTED]", "mypass")
ga.login()

result = self.ga.getMessagesByLabel('python.list', True)
result_len = len(result)
cnt = 0
if result_len:
    for thread in result:
        cnt += 1
        thread_len = len(thread)
        print 'Thread: %d/%d Msg: %d %s' % (cnt,
                                            result_len,
                                            thread_len, 
                                            thread.subject)
        for msg in thread:
            print '  Msg: %d/%d %s' % (msg.number, 
                                       thread_len, 
                                       msg.subject)
            source = msg.source.replace('\r','').lstrip()
            fp.write('From - ' + \
                      strftime("%a %b %d %H:%M:%S %Y", 
                      gmtime()) + '\n')
            fp.write(source)
            fp.write('\n\n')

Thread: 1/1244 Msg: 7 \u003cb\>Deleting objects on the fly\u003c/b\>
  Msg: 1/7 Deleting objects on the fly
  Msg: 2/7 Re: Deleting objects on the fly
  Msg: 3/7 Re: Deleting objects on the fly
  Msg: 4/7 Re: Deleting objects on the fly
  Msg: 5/7 Re: Deleting objects on the fly
  Msg: 6/7 Re: Deleting objects on the fly
  Msg: 7/7 Re: Deleting objects on the fly
Thread: 2/1244 Msg: 1 \u003cb\>A new french book on Python\u003c/b\>
  Msg: 1/1 A new french book on Python
Thread: 3/1244 Msg: 14 \u003cb\>Destruction of generator objects\u003c/b\>
  Msg: 1/14 Destruction of generator objects
  Msg: 2/14 Re: Destruction of generator objects
  Msg: 3/14 Re: Destruction of generator objects
  Msg: 4/14 Re: Destruction of generator objects
  Msg: 5/14 Re: Destruction of generator objects
  Msg: 6/14 Re: Destruction of generator objects
  Msg: 7/14 Re: Destruction of generator objects
  Msg: 8/14 Re: Destruction of generator objects
  Msg: 9/14 Re: Destruction of generator objects
  Msg: 10/14 Re: Destruction of generator objects
  Msg: 11/14 Re: Destruction of generator objects
  Msg: 12/14 Re: Destruction of generator objects
  Msg: 13/14 Re: Destruction of generator objects
  Msg: 14/14 Re: Destruction of generator objects
......
Thread: 307/1244 Msg: 1 MailingLogger 3.2.0 Released!
   Msg: 1/1 MailingLogger 3.2.0 Released!
 Thread: 308/1244 Msg: 13 Why no maintained wrapper to Win32?
   Msg: 1/13 Why no maintained wrapper to Win32?
   Msg: 2/13 Re: Why no maintained wrapper to Win32?
   Msg: 3/13 Re: Why no maintained wrapper to Win32?
   Msg: 4/13 Re: Why no maintained wrapper to Win32?
   Msg: 5/13 Re: Why no maintained wrapper to Win32?
   Msg: 6/13 Re: Why no maintained wrapper to Win32?
   Msg: 7/13 Re: Why no maintained wrapper to Win32?
   Msg: 8/13 Re: Why no maintained wrapper to Win32?
   Msg: 9/13 Re: Why no maintained wrapper to Win32?
   Msg: 10/13 Re: Why no maintained wrapper to Win32?
   Msg: 11/13 Re: Why no maintained wrapper to Win32?
   Msg: 12/13 Re: Why no maintained wrapper to Win32?
   Msg: 13/13 Re: Why no maintained wrapper to Win32?
 Thread: 309/1244 Msg: 5 Encryption recommendation
   Msg: 1/5 Encryption recommendation
   Msg: 2/5 Re: Encryption recommendation
   Msg: 3/5 Re: Encryption recommendation
   Msg: 4/5 Re: Encryption recommendation
   Msg: 5/5 Re: Encryption recommendation
 Thread: 310/1244 Msg: 3 Simple question about logging module.
   Msg: 1/3 Simple question about logging module.
   Msg: 2/3 Re: Simple question about logging module.
   Msg: 3/3 Re: Simple question about logging module.
 Thread: 311/1244 Msg: 5 Plotting Images
   Msg: 1/5 Plotting Images
   Msg: 2/5 Re: Plotting Images
   Msg: 3/5 Re: Plotting Images
   Msg: 4/5 Re: Plotting Images
   Msg: 5/5 Re: Plotting Images
 Thread: 312/1244 Msg: 33 From D
 Thread: 313/1244 Msg: 4 get directory and file names
 Thread: 314/1244 Msg: 7 Compiling 2.5.1 on OpenBSD 4.1
 Thread: 315/1244 Msg: 2 how to add a toolbar to a Frame using wxpython
 Thread: 316/1244 Msg: 1 create a toolbar + images using wxpython for windows
 Thread: 317/1244 Msg: 4 Pysqlite storing file as blob example
 Thread: 318/1244 Msg: 1 Nasm_with_C++_with_Python
 Thread: 319/1244 Msg: 2 interaction of 'with' and 'yield'
 Thread: 320/1244 Msg: 5 problems with logging module
 Thread: 321/1244 Msg: 5 win32 question in Python
 Thread: 322/1244 Msg: 6 File handle not being released by close
 Thread: 323/1244 Msg: 6 Replacing overloaded functions with closures.
 Thread: 324/1244 Msg: 1 Where can I get a complete user interface about 
pylibpcap?
 Thread: 325/1244 Msg: 7 making a variable available in a function from 
decoratorThread: 326/1244 Msg: 1 www.cerocom.com
 Thread: 327/1244 Msg: 6 OOP in Python book?
 Thread: 328/1244 Msg: 3 Help text embedding in C code?
 Thread: 329/1244 Msg: 16 128 or 96 bit integer types?
 Thread: 330/1244 Msg: 2 Re: yield keyword usage
 Thread: 331/1244 Msg: 11 How to write GUI and event separately in wxPython??
 Thread: 332/1244 Msg: 2 ?????????Watch Satellite Channels on your PC - 
FREE!?????????
 Thread: 333/1244 Msg: 3 Database objects? Persistence? Sql Server woes
 Thread: 334/1244 Msg: 5 Bug? exec converts '\n' to newline in docstrings!?
 Thread: 335/1244 Msg: 1 RE: Free support for Python developers
 Thread: 336/1244 Msg: 1 Python-URL! - weekly Python news and links (Jul 30)
 Thread: 337/1244 Msg: 4 Making Gridded Widgets Expandable
 Thread: 338/1244 Msg: 3 pythonic parsing of URL
 Thread: 339/1244 Msg: 13 Detecting __future__ features
 Thread: 340/1244 Msg: 5 Events: The Python Way
 Thread: 341/1244 Msg: 4 Cross platform Python app deployment
 Thread: 342/1244 Msg: 4 encode/decode misunderstanding
 Thread: 343/1244 Msg: 1 Professional Grant Proposal Writing Workshop 
(September 2007: Simon Fraser University)
 Thread: 344/1244 Msg: 8 Hex editor display - can this be more pythonic?
 Thread: 345/1244 Msg: 1 import struct in Python z/OS
 Thread: 346/1244 Msg: 9 wxGlade: Who knows how to drive this application?
 Thread: 347/1244 Msg: 28 Any reason why cStringIO in 2.5 behaves different 
from 2.4?
 Thread: 348/1244 Msg: 15 Installing mod_python on mac os 10.4.7
 Thread: 349/1244 Msg: 1 Xinetd & python server script. problem to get data 
from from client
 Thread: 350/1244 Msg: 2 ctypes:passing python class instances through c and 
backThread: 351/1244 Msg: 2 Bug in cPickle with packages and 'object' inherited 
class
 Thread: 352/1244 Msg: 1 What is the difference about "pycap" and 
"pylibpcap"?
 Thread: 353/1244 Msg: 1 Important new release (was: Crunchy security advisory)
 Thread: 354/1244 Msg: 5 Understanding mxODBC Insert Error
 Thread: 355/1244 Msg: 4 Split a string based on change of character
 Thread: 356/1244 Msg: 5 Python 2.5.1 can't find win32file?
 Thread: 357/1244 Msg: 2 interpreter in the background
 Thread: 358/1244 Msg: 5 Compiling python2.5.1 results in 3.5MB python lib?
 Thread: 359/1244 Msg: 7 problem with change to exceptions
 Thread: 360/1244 Msg: 1 Why Is This The Best Program Online ?
 Thread: 361/1244 Msg: 3 How to stop print printing spaces?
 Thread: 362/1244 Msg: 5 this must be a stupid question ...
 Thread: 363/1244 Msg: 2 Memory utilization (linux v. openbsd)
 Thread: 364/1244 Msg: 1 Test-driven design (was: Comparing Dictionaries)
 Thread: 365/1244 Msg: 1 Crunchy security advisory
 Thread: 366/1244 Msg: 1 http://MoneyCertain.com
 Thread: 367/1244 Msg: 1 ??????????????????FREE Satellite TV on your 
PC??????????????????
 Thread: 368/1244 Msg: 1 great new site for IT GURUS - www.itkong.com
 Thread: 369/1244 Msg: 5 Tkinter -- Show Data in an Excel like Read-Only Grid
 Thread: 370/1244 Msg: 11 a simple string question
 Thread: 371/1244 Msg: 2 How to write a warning to my log file?
 Thread: 372/1244 Msg: 3 How to programmatically insert pages into MDI.
 Thread: 373/1244 Msg: 3 Tkinter program with a usable interpreter console
 Thread: 374/1244 Msg: 2 slow emails
 Thread: 375/1244 Msg: 2 Wikicodia - The code snippets wiki
 Thread: 376/1244 Msg: 6 Compile python with Mingw
 Thread: 377/1244 Msg: 10 removing items from a dictionary ?
 Thread: 378/1244 Msg: 4 Reading data from an ISA port
 Thread: 379/1244 Msg: 4 Removing certain tags from html files
 Thread: 380/1244 Msg: 6 Imported globals?
 Thread: 381/1244 Msg: 3 Packages
 Thread: 382/1244 Msg: 7 Factory pattern again
 Thread: 383/1244 Msg: 2 curses/urwid simple menu
 Thread: 384/1244 Msg: 7 adding a docstring to an instancemethod
 Traceback (most recent call last):
   File "/home/thoujean/bin/gmail.py", line 195, in <module>
     client.archive_list(options.update, options.label)
   File "/home/thoujean/bin/gmail.py", line 142, in archive_list
     self.archive_label(label, update)
   File "/home/thoujean/bin/gmail.py", line 106, in archive_label
     for msg in thread:
   File 
"/usr/local/lib/python2.5/site-packages/libgmail-0.1.6-py2.5.egg/libgmail.py", 
line 1389, in __iter__
     self._messages = self._getMessages(self)
   File 
"/usr/local/lib/python2.5/site-packages/libgmail-0.1.6-py2.5.egg/libgmail.py", 
line 1412, in _getMessages
     q = "in:anywhere")
   File 
"/usr/local/lib/python2.5/site-packages/libgmail-0.1.6-py2.5.egg/libgmail.py", 
line 429, in _parseSearchResult
     return self._parsePage(_buildURL(**params))
   File 
"/usr/local/lib/python2.5/site-packages/libgmail-0.1.6-py2.5.egg/libgmail.py", 
line 402, in _parsePage
     items = _parsePage(self._retrievePage(urlOrRequest))
   File 
"/usr/local/lib/python2.5/site-packages/libgmail-0.1.6-py2.5.egg/libgmail.py", 
line 383, in _retrievePage
     resp = self.opener.open(req)
   File "/usr/local/lib/python2.5/urllib2.py", line 374, in open
     response = self._open(req, data)
   File "/usr/local/lib/python2.5/urllib2.py", line 392, in _open
     '_open', req)
   File "/usr/local/lib/python2.5/urllib2.py", line 353, in _call_chain
     result = func(*args)
   File "/usr/local/lib/python2.5/urllib2.py", line 1109, in https_open
     return self.do_open(httplib.HTTPSConnection, req)
   File "/usr/local/lib/python2.5/urllib2.py", line 1076, in do_open
     raise URLError(err)
 urllib2.URLError: <urlopen error (-3, 'temporary failure in name resolution')>


other information:
Shell:~ >: uname -a
OpenBSD ob41.org 4.1 ob41#0 i386
Shell:~ >: python
Python 2.5 (r25:51908, Mar  8 2007, 20:46:47)
[GCC 3.3.5 (propolice)] on openbsd4
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import libgmail
>>> print libgmail.Version
0.1.6
>>>


-- 
Best Regards,
        No.23
----
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to