From 92ca7d440f02b034d1a8fc27370ef6b5d9daf5d4 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Thu, 12 Aug 2010 09:25:09 +0200 Subject: [PATCH] new frontend geolooc --- scripts/geolooc | 25 +++++++++++++++ weboob/applications/geolooc/__init__.py | 20 ++++++++++++ weboob/applications/geolooc/geolooc.py | 42 +++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100755 scripts/geolooc create mode 100644 weboob/applications/geolooc/__init__.py create mode 100644 weboob/applications/geolooc/geolooc.py diff --git a/scripts/geolooc b/scripts/geolooc new file mode 100755 index 0000000000..1dd3b23a44 --- /dev/null +++ b/scripts/geolooc @@ -0,0 +1,25 @@ +#!/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.applications.geolooc import Geolooc + + +if __name__ == '__main__': + Geolooc.run() diff --git a/weboob/applications/geolooc/__init__.py b/weboob/applications/geolooc/__init__.py new file mode 100644 index 0000000000..1cb1c74d4b --- /dev/null +++ b/weboob/applications/geolooc/__init__.py @@ -0,0 +1,20 @@ +# -*- 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 .geolooc import Geolooc diff --git a/weboob/applications/geolooc/geolooc.py b/weboob/applications/geolooc/geolooc.py new file mode 100644 index 0000000000..b41b39c694 --- /dev/null +++ b/weboob/applications/geolooc/geolooc.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +# 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. + + +import logging + +from weboob.capabilities.geolocip import ICapGeolocIp +from weboob.tools.application.console import ConsoleApplication + + +__all__ = ['Geolooc'] + + +class Geolooc(ConsoleApplication): + APPNAME = 'geolooc' + VERSION = '0.1' + COPYRIGHT = 'Copyright(C) 2010 Romain Bignon' + + def main(self, argv): + if len(argv) < 2: + print >>sys.stderr, 'Syntax: %s ipaddr' % argv[0] + return 1 + + self.load_configured_backends(ICapGeolocIp) + for backend, location in self.weboob.do('get_location', argv[1]): + self.format(location, backend.name) + + return 0 -- GitLab