From b6a4c0d43934dc881f57bf3981e4f134d1e0decb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Thu, 29 Sep 2016 18:49:20 +0200 Subject: [PATCH] Add linuxjobs.fr module boilerplate --- modules/linuxjobs/__init__.py | 24 +++++++++++++ modules/linuxjobs/browser.py | 39 ++++++++++++++++++++ modules/linuxjobs/module.py | 68 +++++++++++++++++++++++++++++++++++ modules/linuxjobs/pages.py | 31 ++++++++++++++++ modules/linuxjobs/test.py | 28 +++++++++++++++ 5 files changed, 190 insertions(+) create mode 100644 modules/linuxjobs/__init__.py create mode 100644 modules/linuxjobs/browser.py create mode 100644 modules/linuxjobs/module.py create mode 100644 modules/linuxjobs/pages.py create mode 100644 modules/linuxjobs/test.py diff --git a/modules/linuxjobs/__init__.py b/modules/linuxjobs/__init__.py new file mode 100644 index 0000000000..d0e16e347b --- /dev/null +++ b/modules/linuxjobs/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2016 François Revol +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from .module import LinuxJobsModule + + +__all__ = ['LinuxJobsModule'] diff --git a/modules/linuxjobs/browser.py b/modules/linuxjobs/browser.py new file mode 100644 index 0000000000..b578f7ce6b --- /dev/null +++ b/modules/linuxjobs/browser.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2016 François Revol +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from weboob.browser import PagesBrowser, URL + +from .pages import Page1, Page2 + + +class LinuxJobsBrowser(PagesBrowser): + BASEURL = 'http://www.linuxjobs.com' + + page1 = URL('/page1\?id=(?P.+)', Page1) + page2 = URL('/page2', Page2) + + def get_stuff(self, _id): + self.page1.go(id=_id) + + assert self.page1.is_here() + self.page.do_stuff(_id) + + assert self.page2.is_here() + return self.page.do_more_stuff() diff --git a/modules/linuxjobs/module.py b/modules/linuxjobs/module.py new file mode 100644 index 0000000000..0984cdf508 --- /dev/null +++ b/modules/linuxjobs/module.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2016 François Revol +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from weboob.tools.backend import Module +from weboob.capabilities.job import CapJob + +from .browser import LinuxJobsBrowser + + +__all__ = ['LinuxJobsModule'] + + +class LinuxJobsModule(Module, CapJob): + NAME = 'linuxjobs' + DESCRIPTION = u'linuxjobs website' + MAINTAINER = u'François Revol' + EMAIL = 'revol@free.fr' + LICENSE = 'AGPLv3+' + VERSION = '1.2' + + BROWSER = LinuxJobsBrowser + + def advanced_search_job(self): + """ + Iter results of an advanced search + + :rtype: iter[:class:`BaseJobAdvert`] + """ + raise NotImplementedError() + + def get_job_advert(self, _id, advert=None): + """ + Get an announce from an ID. + + :param _id: id of the advert + :type _id: str + :param advert: the advert + :type advert: BaseJobAdvert + :rtype: :class:`BaseJobAdvert` or None if not found. + """ + raise NotImplementedError() + + def search_job(self, pattern=None): + """ + Iter results of a search on a pattern. + + :param pattern: pattern to search on + :type pattern: str + :rtype: iter[:class:`BaseJobAdvert`] + """ + raise NotImplementedError() diff --git a/modules/linuxjobs/pages.py b/modules/linuxjobs/pages.py new file mode 100644 index 0000000000..9afe015a06 --- /dev/null +++ b/modules/linuxjobs/pages.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2016 François Revol +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from weboob.browser.pages import HTMLPage + + +class Page1(HTMLPage): + def do_stuff(self, _id): + raise NotImplementedError() + + +class Page2(HTMLPage): + def do_more_stuff(self): + raise NotImplementedError() diff --git a/modules/linuxjobs/test.py b/modules/linuxjobs/test.py new file mode 100644 index 0000000000..add49e695e --- /dev/null +++ b/modules/linuxjobs/test.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# Copyright(C) 2016 François Revol +# +# This file is part of weboob. +# +# weboob is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# weboob 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with weboob. If not, see . + + +from weboob.tools.test import BackendTest + + +class LinuxJobsTest(BackendTest): + MODULE = 'linuxjobs' + + def test_linuxjobs(self): + raise NotImplementedError() -- GitLab