new frontend weboob-debug
This commit is contained in:
parent
73ffa6c6f1
commit
3f49908d86
3 changed files with 86 additions and 0 deletions
23
scripts/weboob-debug
Executable file
23
scripts/weboob-debug
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/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.weboobdebug import WeboobDebug
|
||||
|
||||
if __name__ == '__main__':
|
||||
WeboobDebug.run()
|
||||
18
weboob/frontends/weboobdebug/__init__.py
Normal file
18
weboob/frontends/weboobdebug/__init__.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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 .application import WeboobDebug
|
||||
45
weboob/frontends/weboobdebug/application.py
Normal file
45
weboob/frontends/weboobdebug/application.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from weboob.tools.application import ConsoleApplication
|
||||
|
||||
|
||||
class WeboobDebug(ConsoleApplication):
|
||||
APPNAME = 'weboobdebug'
|
||||
VERSION = '1.0'
|
||||
COPYRIGHT = 'Copyright(C) 2010 Christophe Benz'
|
||||
|
||||
def main(self, argv):
|
||||
return self.process_command(*argv[1:])
|
||||
|
||||
@ConsoleApplication.command('Debug backend')
|
||||
def command_shell(self, backend_name):
|
||||
try:
|
||||
backend = self.weboob.load_backends(names=[backend_name])[backend_name]
|
||||
except KeyError:
|
||||
logging.error(u'Unable to load backend "%s"' % backend_name)
|
||||
return 1
|
||||
browser = backend.browser
|
||||
from IPython.Shell import IPShellEmbed
|
||||
shell = IPShellEmbed()
|
||||
locs = dict(backend=backend, browser=browser)
|
||||
banner = 'Weboob debug shell\nBackend "%s" loaded.\nAvailable variables: %s' % (backend_name, locs)
|
||||
shell.set_banner(shell.IP.BANNER + '\n\n' + banner)
|
||||
shell(local_ns=locs, global_ns={})
|
||||
Loading…
Add table
Add a link
Reference in a new issue