pax_global_header 0000666 0000000 0000000 00000000064 11361025537 0014515 g ustar 00root root 0000000 0000000 52 comment=0c71eb643d5b82e797b64217a43261a124d3aeb8 woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/ 0000775 0000000 0000000 00000000000 11361025537 0020777 5 ustar 00root root 0000000 0000000 woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/ 0000775 0000000 0000000 00000000000 11361025537 0022466 5 ustar 00root root 0000000 0000000 woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/boobank 0000775 0000000 0000000 00000006130 11361025537 0024027 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai """ Copyright(C) 2009-2010 Romain Bignon This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from __future__ import with_statement import sys import weboob from weboob.capabilities.bank import ICapBank, AccountNotFound from weboob.tools.application import ConsoleApplication class Boobank(ConsoleApplication): APPNAME = 'boobank' def main(self, argv): self.weboob.load_backends(ICapBank) return self.process_command(*argv[1:]) @ConsoleApplication.command('List every available accounts') def command_list(self): accounts = [] for name, backend, in self.weboob.iter_backends(): try: for account in backend.iter_accounts(): accounts.append('%17s %-20s %11.2f %11.2f' % ( account.id, account.label, account.balance, account.coming)) except weboob.tools.browser.BrowserIncorrectPassword: print >>sys.stderr, 'Error: Incorrect password for backend %s' % name return 1 if len(accounts): print ' ID Account Balance Coming ' print '+-----------------+---------------------+--------------+-------------+' print '\n'.join(accounts) else: print 'No accounts found' @ConsoleApplication.command('Display all future operations') def command_coming(self, id): operations = [] found = 0 for name, backend in self.weboob.iter_backends(): try: account = backend.get_account(id) except AccountNotFound: if found == 0: found = -1 else: found = 1 for operation in backend.iter_operations(account): operations.append(' %8s %-50s %11.2f' % (operation.date, operation.label, operation.amount)) if found < 0: print >>sys.stderr, "Error: account %s not found" % id return 1 else: if operations: print ' Date Label Amount ' print '+----------+----------------------------------------------------+-------------+' print '\n'.join(operations) else: print 'No coming operations for ID=%s' % id if __name__ == '__main__': Boobank.run() woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/dummy 0000775 0000000 0000000 00000005020 11361025537 0023544 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai """ Copyright(C) 2010 Romain Bignon This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from weboob.capabilities.bank import ICapBank from weboob.capabilities.messages import ICapMessages, ICapMessagesReply from weboob.capabilities.travel import ICapTravel from weboob.tools.application import BaseApplication class Application(BaseApplication): APPNAME = 'dummy' def main(self, argv): self.weboob.load_backends() for name, backend in self.weboob.iter_backends(): print 'Backend [%s]' % name if backend.has_caps(ICapMessages): print '|- ICapMessages [Print its messages]' for message in backend.iter_messages(): print '| |- %s' % message if backend.has_caps(ICapMessagesReply): print '|- ICapMessagesReply [TODO]' if backend.has_caps(ICapTravel): print '|- ICapTravel.stations [Search station \'defense\']' s = None for station in backend.iter_station_search('defense'): print '| |- [%s] %s' % (station.id, station.name) if s is None: s = station.id print '|- ICapTravel.departures [Departures from \'%s\']' % s for departure in backend.iter_station_departures(s): print '| |- [%s] %s at %s to %s' % (departure.id, departure.type, departure.time.strftime("%H:%M"), departure.arrival_station) if backend.has_caps(ICapBank): for account in backend.iter_accounts(): print '| |- [%s] label=%s balance=%s coming=%s' % ( account.id, account.label, account.balance, account.coming) if __name__ == '__main__': Application.run() woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/havesex 0000775 0000000 0000000 00000001561 11361025537 0024062 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai """ Copyright(C) 2010 Romain Bignon This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from weboob.frontends.havesex import HaveSex if __name__ == '__main__': HaveSex.run() woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/http 0000775 0000000 0000000 00000001600 11361025537 0023370 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai """ Copyright(C) 2010 Christophe Benz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from weboob.frontends.http import HTTPApplication if __name__ == '__main__': HTTPApplication.run() woob-0c71eb643d5b82e797b64217a43261a124d3aeb8-scripts/scripts/monboob 0000775 0000000 0000000 00000014727 11361025537 0024062 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai """ Copyright(C) 2010 Romain Bignon This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from email.mime.text import MIMEText from smtplib import SMTP from email.Header import Header from email.Utils import parseaddr, formataddr from email import message_from_file import time import re import sys from weboob.capabilities.messages import ICapMessages, ICapMessagesReply from weboob.tools.application import ConsoleApplication from weboob.tools.misc import html2text class Monboob(ConsoleApplication): APPNAME = 'monboob' CONFIG = {'interval': 15, 'domain': 'weboob.example.org', 'recipient': 'weboob@example.org', 'smtp': 'localhost', 'html': False} def main(self, argv): self.load_config() self.weboob.load_backends(ICapMessages, storage=self.create_storage()) return self.process_command(*argv[1:]) @ConsoleApplication.command("pipe with a mail to post message") def command_post(self): msg = message_from_file(sys.stdin) reply_to = msg.get('In-Reply-To') if not reply_to: print >>sys.stderr, 'This is not a reply (no Reply-To field)' return 1 m = re.match('<(.*)@(.*)>', reply_to) if m: reply_to = m.group(1) title = msg.get('Subject') content = u'' for part in msg.walk(): if part.get_content_type() == 'text/plain': s = part.get_payload(decode=True) charsets = part.get_charsets() + msg.get_charsets() for charset in charsets: try: content += unicode(s, charset) except: continue else: break # remove signature content = content.split(u'\n-- \n')[0] bname, id = reply_to.split('.', 1) try: backend = self.weboob.backends[bname] except KeyError: print >>sys.stderr, 'Backend %s not found' % bname return 1 if not backend.has_caps(ICapMessagesReply): print >>sys.stderr, 'The backend %s does not implement ICapMessagesReply' % bname return 1 thread_id, msg_id = id.rsplit('.', 1) backend.post_reply(thread_id, msg_id, title, content) @ConsoleApplication.command("run daemon") def command_run(self): self.weboob.repeat(self.config.get('interval'), self.process) self.weboob.loop() def process(self): for name, backend in self.weboob.iter_backends(): for message in backend.iter_new_messages(): self.send_email(backend, message) def send_email(self, backend, mail): domain = self.config.get('domain') recipient = self.config.get('recipient') reply_id = '' if mail.get_reply_id(): reply_id = u'<%s.%s@%s>' % (backend.name, mail.get_full_reply_id(), domain) subject = mail.get_title() sender = u'%s <%s@%s>' % (mail.get_from(), backend.name, domain) # assume that get_date() returns an UTC datetime date = time.strftime('%a, %d %b %Y %H:%M:%S +0000', mail.get_date().timetuple()) msg_id = u'<%s.%s@%s>' % (backend.name, mail.get_full_id(), domain) if self.config.get('html') and mail.is_html: body = mail.get_content() content_type = 'html' else: if mail.is_html: body = html2text(mail.get_content()) else: body = mail.get_content() content_type = 'plain' if mail.get_signature(): if self.config.get('html') and mail.is_html: body += u'
--
%s