From 444d36eee835a525c3ffd02fdce36e88fb509745 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 23 Sep 2014 10:50:25 +0200 Subject: [PATCH] Rename BasePage to Page --- docs/source/guides/module.rst | 2 +- modules/750g/pages.py | 6 ++--- modules/adecco/pages.py | 6 ++--- modules/allrecipes/pages.py | 8 +++---- modules/ameli/pages.py | 4 ++-- modules/amelipro/pages.py | 12 +++++----- modules/americanexpress/pages.py | 8 +++---- modules/apec/pages.py | 6 ++--- modules/apivie/pages.py | 8 +++---- modules/arretsurimages/pages.py | 10 ++++---- modules/arte/pages.py | 6 ++--- modules/attilasub/pages.py | 6 ++--- modules/axabanque/pages.py | 2 +- modules/banquepopulaire/pages.py | 2 +- modules/barclays/pages.py | 12 +++++----- modules/bnporc/enterprise/pages.py | 4 ++-- modules/bnporc/perso/accounts_list.py | 4 ++-- modules/bnporc/perso/login.py | 10 ++++---- modules/bnporc/perso/messages.py | 6 ++--- modules/bnporc/perso/transactions.py | 4 ++-- modules/bnporc/perso/transfer.py | 8 +++---- modules/bnporc/pro.py | 6 ++--- modules/boursorama/pages/account_history.py | 4 ++-- modules/boursorama/pages/accounts_list.py | 4 ++-- modules/boursorama/pages/card_history.py | 4 ++-- modules/boursorama/pages/login.py | 6 ++--- .../boursorama/pages/two_authentication.py | 4 ++-- modules/bouygues/pages/compose.py | 10 ++++---- modules/bouygues/pages/login.py | 6 ++--- modules/bp/pages/accounthistory.py | 6 ++--- modules/bp/pages/accountlist.py | 4 ++-- modules/bp/pages/login.py | 16 ++++++------- modules/bp/pages/transfer.py | 10 ++++---- modules/bred/pages.py | 12 +++++----- modules/btdigg/pages/index.py | 4 ++-- modules/btdigg/pages/torrents.py | 6 ++--- modules/btmon/pages.py | 6 ++--- modules/caissedepargne/pages.py | 8 +++---- modules/canalplus/pages.py | 6 ++--- modules/cappedtv/browser.py | 6 ++--- modules/champslibres/pages.py | 14 +++++------ modules/chronopost/pages.py | 6 ++--- modules/cic/pages.py | 22 ++++++++--------- modules/citelis/pages.py | 14 +++++------ modules/cmso/pages.py | 8 +++---- modules/colisprive/pages.py | 6 ++--- modules/cragr/mobile/pages/base.py | 4 ++-- modules/cragr/web/pages.py | 16 ++++++------- modules/creditcooperatif/perso/pages.py | 14 +++++------ modules/creditcooperatif/pro/pages.py | 8 +++---- modules/creditdunord/pages.py | 6 ++--- modules/cuisineaz/pages.py | 6 ++--- modules/dailymotion/pages.py | 6 ++--- modules/delubac/pages.py | 8 +++---- modules/dlfp/pages/board.py | 4 ++-- modules/dlfp/pages/index.py | 4 ++-- modules/edf/pages.py | 4 ++-- modules/ehentai/pages.py | 12 +++++----- modules/europarl/pages.py | 4 ++-- modules/fortuneo/pages/accounts_list.py | 8 +++---- modules/fortuneo/pages/login.py | 4 ++-- modules/fourchan/pages/board.py | 4 ++-- modules/ganassurances/pages.py | 8 +++---- modules/gazelle/pages/base.py | 2 +- modules/gdcvault/pages.py | 8 +++---- modules/gdfsuez/pages/history.py | 4 ++-- modules/gdfsuez/pages/homepage.py | 10 ++++---- modules/googletranslate/pages.py | 4 ++-- modules/hds/pages.py | 12 +++++----- modules/hellobank/perso/accounts_list.py | 4 ++-- modules/hellobank/perso/login.py | 8 +++---- modules/hellobank/perso/messages.py | 6 ++--- modules/hellobank/perso/transactions.py | 4 ++-- modules/hellobank/perso/transfer.py | 8 +++---- modules/imdb/pages.py | 10 ++++---- modules/ina/pages/search.py | 4 ++-- modules/ina/pages/video.py | 4 ++-- modules/izneo/module.py | 4 ++-- modules/jacquieetmichel/pages.py | 6 ++--- modules/jvmalin/pages.py | 8 +++---- modules/kickass/pages.py | 6 ++--- modules/lacentrale/pages.py | 8 +++---- modules/lcl/enterprise/pages.py | 18 +++++++------- modules/lcl/pages.py | 12 +++++----- modules/leclercmobile/pages/history.py | 4 ++-- modules/leclercmobile/pages/homepage.py | 4 ++-- modules/leclercmobile/pages/login.py | 4 ++-- modules/lefigaro/browser.py | 4 ++-- modules/lolix/pages.py | 6 ++--- modules/lutim/pages.py | 4 ++-- modules/marmiton/pages.py | 6 ++--- modules/meteofrance/pages/meteo.py | 6 ++--- modules/monster/pages.py | 6 ++--- modules/nectarine/pages.py | 6 ++--- modules/nettokom/pages/history.py | 8 +++---- modules/nettokom/pages/homepage.py | 4 ++-- modules/nettokom/pages/login.py | 4 ++-- modules/nihonnooto/pages.py | 6 ++--- modules/nolifetv/pages.py | 14 +++++------ modules/okc/browser.py | 4 ++-- modules/okc/pages.py | 20 ++++++++-------- modules/opacwebaloes/pages.py | 14 +++++------ modules/opensubtitles/pages.py | 8 +++---- modules/orange/pages/compose.py | 6 ++--- modules/orange/pages/login.py | 4 ++-- modules/ovs/pages.py | 8 +++---- modules/pap/pages.py | 6 ++--- modules/pariskiwi/pages.py | 8 +++---- modules/parolesmania/pages.py | 10 ++++---- modules/parolesmusique/pages.py | 12 +++++----- modules/parolesnet/pages.py | 10 ++++---- modules/paypal/pages.py | 16 ++++++------- modules/phpbb/pages/index.py | 4 ++-- modules/piratebay/pages/index.py | 4 ++-- modules/piratebay/pages/torrents.py | 6 ++--- modules/pixtoilelibre/pages.py | 8 +++---- modules/podnapisi/pages.py | 6 ++--- modules/popolemploi/pages.py | 6 ++--- modules/prixcarburants/pages.py | 8 +++---- modules/radiofrance/browser.py | 10 ++++---- modules/redmine/pages/index.py | 10 ++++---- modules/redmine/pages/issues.py | 8 +++---- modules/redmine/pages/wiki.py | 6 ++--- modules/seeklyrics/pages.py | 10 ++++---- modules/seloger/pages.py | 6 ++--- modules/sfr/pages/compose.py | 10 ++++---- modules/sfr/pages/login.py | 4 ++-- modules/societegenerale/pages/base.py | 2 +- modules/societegenerale/sgpe/pages.py | 4 ++-- modules/sueurdemetal/pages.py | 8 +++---- modules/supertoinette/pages.py | 6 ++--- modules/trictractv/pages.py | 6 ++--- modules/tvsubtitles/pages.py | 10 ++++---- modules/ups/pages.py | 4 ++-- modules/voyagessncf/pages.py | 14 +++++------ modules/weather/pages.py | 8 +++---- modules/wellsfargo/pages.py | 4 ++-- modules/wordreference/pages.py | 4 ++-- modules/youporn/pages/base.py | 4 ++-- modules/youtube/pages.py | 10 ++++---- weboob/tools/browser/__init__.py | 4 ++-- weboob/tools/browser/browser.py | 6 ++--- weboob/tools/browser2/__init__.py | 4 ++-- weboob/tools/browser2/page.py | 24 +++++++++---------- .../gallery/genericcomicreader.py | 4 ++-- .../capabilities/messages/genericArticle.py | 4 ++-- 146 files changed, 525 insertions(+), 525 deletions(-) diff --git a/docs/source/guides/module.rst b/docs/source/guides/module.rst index adad6c5f24..7db1cd7ac6 100644 --- a/docs/source/guides/module.rst +++ b/docs/source/guides/module.rst @@ -330,7 +330,7 @@ Then, each method on your browser which need your user to be authenticated may b return self.page.get_accounts() The last thing to know is that :func:`need_login ` checks if the current page is a logged one by -reading the attribute :func:`logged ` of the instance. You can either define it yourself, as a +reading the attribute :func:`logged ` of the instance. You can either define it yourself, as a class boolean attribute or as a property, or to inherit your class from :class:`LoggedPage `. diff --git a/modules/750g/pages.py b/modules/750g/pages.py index e5da329cb0..ea69ee4589 100644 --- a/modules/750g/pages.py +++ b/modules/750g/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ResultsPage(BasePage): +class ResultsPage(Page): """ Page which contains results as a list of recipies """ def iter_recipes(self): @@ -62,7 +62,7 @@ def iter_recipes(self): yield recipe -class RecipePage(BasePage): +class RecipePage(Page): """ Page which contains a recipe """ def get_recipe(self, id): diff --git a/modules/adecco/pages.py b/modules/adecco/pages.py index f021a6f185..353e387e2a 100644 --- a/modules/adecco/pages.py +++ b/modules/adecco/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text from .job import AdeccoJobAdvert import datetime @@ -27,7 +27,7 @@ MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre'] -class SearchPage(BasePage): +class SearchPage(Page): def iter_job_adverts(self): re_id = re.compile('http://www.adecco.fr/trouver-un-emploi/Pages/Details-de-l-Offre/(.*?)/(.*?).aspx\?IOF=(.*?)$', re.DOTALL) @@ -55,7 +55,7 @@ def iter_job_adverts(self): yield advert -class AdvertPage(BasePage): +class AdvertPage(Page): def get_job_advert(self, url, advert): re_id = re.compile('http://www.adecco.fr/trouver-un-emploi/Pages/Details-de-l-Offre/(.*?)/(.*?).aspx\?IOF=(.*?)$', re.DOTALL) if advert is None: diff --git a/modules/allrecipes/pages.py b/modules/allrecipes/pages.py index 4da89fa7f8..d33684ec0e 100644 --- a/modules/allrecipes/pages.py +++ b/modules/allrecipes/pages.py @@ -20,14 +20,14 @@ from weboob.capabilities.recipe import Recipe from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class FourOFourPage(BasePage): +class FourOFourPage(Page): pass -class ResultsPage(BasePage): +class ResultsPage(Page): """ Page which contains results as a list of recipies """ def iter_recipes(self): @@ -56,7 +56,7 @@ def iter_recipes(self): yield recipe -class RecipePage(BasePage): +class RecipePage(Page): """ Page which contains a recipe """ def get_recipe(self, id): diff --git a/modules/ameli/pages.py b/modules/ameli/pages.py index e4007742f5..cc31a003f9 100644 --- a/modules/ameli/pages.py +++ b/modules/ameli/pages.py @@ -22,14 +22,14 @@ import re import urllib from decimal import Decimal -from weboob.tools.browser import BasePage,BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities.bill import Subscription, Detail, Bill # Ugly array to avoid the use of french locale FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre'] -class AmeliBasePage(BasePage): +class AmeliBasePage(Page): def is_logged(self): try: self.parser.select(self.document.getroot(), 'a.logout', 1) diff --git a/modules/amelipro/pages.py b/modules/amelipro/pages.py index fb060abdfe..1057624eda 100644 --- a/modules/amelipro/pages.py +++ b/modules/amelipro/pages.py @@ -22,7 +22,7 @@ from decimal import Decimal import re import urllib -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bill import Subscription, Detail, Bill @@ -30,7 +30,7 @@ FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre'] -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form('connexionCompteForm') self.browser["vp_connexion_portlet_1numPS"] = login.encode('utf8') @@ -38,13 +38,13 @@ def login(self, login, password): self.browser.submit() -class HomePage(BasePage): +class HomePage(Page): def on_loaded(self): pass -class AccountPage(BasePage): +class AccountPage(Page): def get_subscription_list(self): ident = self.document.xpath('//div[@id="identification"]')[0] @@ -59,7 +59,7 @@ def get_subscription_list(self): return sub -class HistoryPage(BasePage): +class HistoryPage(Page): def iter_history(self): table = self.document.xpath('//table[contains(concat(" ", @class, " "), " cTableauTriable ")]')[0].xpath('.//tr') @@ -83,7 +83,7 @@ def iter_history(self): yield det -class BillsPage(BasePage): +class BillsPage(Page): def iter_bills(self): table = self.document.xpath('//table[@id="releveCompteMensuel"]')[0].xpath('.//tr') diff --git a/modules/americanexpress/pages.py b/modules/americanexpress/pages.py index c4b7b60a81..3012ec5a3c 100644 --- a/modules/americanexpress/pages.py +++ b/modules/americanexpress/pages.py @@ -22,14 +22,14 @@ from decimal import Decimal import re -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities.bank import Account from weboob.capabilities import NotAvailable from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction from weboob.tools.date import ChaoticDateGuesser -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(name='ssoform') self.browser.set_all_readonly(False) @@ -40,7 +40,7 @@ def login(self, username, password): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): def get_list(self): for box in self.document.getroot().cssselect('div.roundedBox div.contentBox'): a = Account() @@ -56,7 +56,7 @@ def get_list(self): yield a -class TransactionsPage(BasePage): +class TransactionsPage(Page): COL_ID = 0 COL_DATE = 1 COL_DEBIT_DATE = 2 diff --git a/modules/apec/pages.py b/modules/apec/pages.py index 2b86840d9e..ea71a9a50d 100644 --- a/modules/apec/pages.py +++ b/modules/apec/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text import dateutil.parser import re @@ -26,7 +26,7 @@ from .job import ApecJobAdvert -class SearchPage(BasePage): +class SearchPage(Page): def iter_job_adverts(self): re_id_title = re.compile('/offres-emploi-cadres/\d*_\d*_\d*_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?).html', re.DOTALL) divs = self.document.getroot().xpath("//div[@class='boxContent offre']") + self.document.getroot().xpath("//div[@class='boxContent offre even']") @@ -43,7 +43,7 @@ def iter_job_adverts(self): yield advert -class AdvertPage(BasePage): +class AdvertPage(Page): def get_job_advert(self, url, advert): re_id_title = re.compile('/offres-emploi-cadres/\d*_\d*_\d*_(.*?)________(.*?).html(.*?)', re.DOTALL) if advert is None: diff --git a/modules/apivie/pages.py b/modules/apivie/pages.py index e694a62ad3..347a855ede 100644 --- a/modules/apivie/pages.py +++ b/modules/apivie/pages.py @@ -21,11 +21,11 @@ from decimal import Decimal from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(nr=0) self.browser['_58_login'] = username.encode('utf-8') @@ -33,7 +33,7 @@ def login(self, username, password): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): COL_LABEL = 0 COL_OWNER = 1 COL_ID = 2 @@ -59,7 +59,7 @@ class Transaction(FrenchTransaction): pass -class OperationsPage(BasePage): +class OperationsPage(Page): COL_DATE = 0 COL_LABEL = 1 COL_AMOUNT = 2 diff --git a/modules/arretsurimages/pages.py b/modules/arretsurimages/pages.py index 11e082c1c2..8f9acd0b8d 100644 --- a/modules/arretsurimages/pages.py +++ b/modules/arretsurimages/pages.py @@ -21,14 +21,14 @@ from weboob.capabilities.base import UserError from weboob.capabilities.image import BaseImage -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities import NotAvailable from .video import ArretSurImagesVideo -class IndexPage(BasePage): +class IndexPage(Page): def iter_videos(self): videos = self.document.getroot().cssselect("div[class=bloc-contenu-8]") for div in videos: @@ -55,7 +55,7 @@ class ForbiddenVideo(UserError): pass -class VideoPage(BasePage): +class VideoPage(Page): def is_logged(self): try: self.parser.select(self.document.getroot(), '#user-info', 1) @@ -106,7 +106,7 @@ def get_url(self): return url -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): response = self.browser.response() response.set_data(response.get_data().replace("
", "
")) # Python mechanize is broken, fixing it. @@ -119,5 +119,5 @@ def login(self, username, password): self.browser.submit() -class LoginRedirectPage(BasePage): +class LoginRedirectPage(Page): pass diff --git a/modules/arte/pages.py b/modules/arte/pages.py index 013ac7cf3e..c686d44b1b 100644 --- a/modules/arte/pages.py +++ b/modules/arte/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text from weboob.capabilities import NotAvailable from weboob.capabilities.image import BaseImage @@ -26,7 +26,7 @@ from .video import ArteLiveVideo -class ArteLiveVideoPage(BasePage): +class ArteLiveVideoPage(Page): def get_video(self, video=None): if not video: video = ArteLiveVideo(self.group_dict['id']) @@ -43,7 +43,7 @@ def get_video(self, video=None): return json_url, video -class ArteLivePage(BasePage): +class ArteLivePage(Page): def iter_resources(self): items = list() for el in self.document.xpath('//ul[@class="filter-liste"]/li'): diff --git a/modules/attilasub/pages.py b/modules/attilasub/pages.py index aca5fff237..3e09ca6683 100644 --- a/modules/attilasub/pages.py +++ b/modules/attilasub/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.subtitle import Subtitle from weboob.capabilities.base import NotAvailable -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class SearchPage(BasePage): +class SearchPage(Page): def iter_subtitles(self, language, pattern): fontresult = self.parser.select(self.document.getroot(), 'div.search-results font.search-results') # for each result in freefind, explore the subtitle list page to iter subtitles @@ -37,7 +37,7 @@ def iter_subtitles(self, language, pattern): yield subtitle -class SubtitlesPage(BasePage): +class SubtitlesPage(Page): def get_subtitle(self, id): href = id.split('|')[1] # we have to find the 'tr' which contains the link to this address diff --git a/modules/axabanque/pages.py b/modules/axabanque/pages.py index 7bcaf538d5..830f8e9e08 100644 --- a/modules/axabanque/pages.py +++ b/modules/axabanque/pages.py @@ -22,7 +22,7 @@ from decimal import Decimal, InvalidOperation import re -from weboob.tools.browser import BasePage as _BasePage, BrowserUnavailable, BrokenPageError +from weboob.tools.browser import Page as _BasePage, BrowserUnavailable, BrokenPageError from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard diff --git a/modules/banquepopulaire/pages.py b/modules/banquepopulaire/pages.py index c78e7c7324..2529205635 100644 --- a/modules/banquepopulaire/pages.py +++ b/modules/banquepopulaire/pages.py @@ -24,7 +24,7 @@ import re from mechanize import Cookie, FormNotFoundError -from weboob.tools.browser import BasePage as _BasePage, BrowserUnavailable, BrokenPageError +from weboob.tools.browser import Page as _BasePage, BrowserUnavailable, BrokenPageError from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction diff --git a/modules/barclays/pages.py b/modules/barclays/pages.py index 9c9dd518da..27cb08e626 100644 --- a/modules/barclays/pages.py +++ b/modules/barclays/pages.py @@ -22,12 +22,12 @@ from decimal import Decimal import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(name='frmLogin') self.browser['username'] = login.encode(self.browser.ENCODING) @@ -41,7 +41,7 @@ def has_redirect(self): return True -class Login2Page(BasePage): +class Login2Page(Page): def login(self, secret): label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip() letters = '' @@ -53,11 +53,11 @@ def login(self, secret): self.browser.submit(name='valider', nologin=True) -class IndexPage(BasePage): +class IndexPage(Page): pass -class AccountsPage(BasePage): +class AccountsPage(Page): ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS, u'Liquidités': Account.TYPE_CHECKING, u'Titres': Account.TYPE_MARKET, @@ -170,7 +170,7 @@ class Transaction(FrenchTransaction): ] -class HistoryBasePage(BasePage): +class HistoryBasePage(Page): def get_history(self): self.logger.warning('Do not support account of type %s' % type(self).__name__) return iter([]) diff --git a/modules/bnporc/enterprise/pages.py b/modules/bnporc/enterprise/pages.py index 018764f3db..204f392f02 100644 --- a/modules/bnporc/enterprise/pages.py +++ b/modules/bnporc/enterprise/pages.py @@ -24,7 +24,7 @@ import re from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardError from weboob.tools.misc import to_unicode @@ -50,7 +50,7 @@ class Transaction(FrenchTransaction): ] -class BEPage(BasePage): +class BEPage(Page): def get_error(self): for title in self.document.xpath('/html/head/title'): if 'erreur' in title.text or 'error' in title.text: diff --git a/modules/bnporc/perso/accounts_list.py b/modules/bnporc/perso/accounts_list.py index 70af5c4d2d..4d8d596b6b 100644 --- a/modules/bnporc/perso/accounts_list.py +++ b/modules/bnporc/perso/accounts_list.py @@ -24,10 +24,10 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.capabilities.bank import Account from weboob.capabilities.base import NotAvailable -from weboob.tools.browser import BasePage, BrokenPageError, BrowserPasswordExpired +from weboob.tools.browser import Page, BrokenPageError, BrowserPasswordExpired -class AccountsList(BasePage): +class AccountsList(Page): ACCOUNT_TYPES = { u'Liquidités': Account.TYPE_CHECKING, u'Epargne disponible': Account.TYPE_SAVINGS, diff --git a/modules/bnporc/perso/login.py b/modules/bnporc/perso/login.py index 81a0e8805c..27edb8d727 100644 --- a/modules/bnporc/perso/login.py +++ b/modules/bnporc/perso/login.py @@ -22,7 +22,7 @@ import re import urllib -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError @@ -72,7 +72,7 @@ def get_string_code(self, string): return code -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): for td in self.document.getroot().cssselect('td.LibelleErreur'): if td.text is None: @@ -101,7 +101,7 @@ def login(self, login, password): self.browser.location(url, urllib.urlencode(params)) -class ConfirmPage(BasePage): +class ConfirmPage(Page): def get_error(self): for td in self.document.xpath('//td[@class="hdvon1"]'): if td.text: @@ -115,12 +115,12 @@ def get_relocate_url(self): return m.group(1) -class InfoMessagePage(BasePage): +class InfoMessagePage(Page): def on_loaded(self): pass -class ChangePasswordPage(BasePage): +class ChangePasswordPage(Page): def change_password(self, current, new): try: vk=BNPVirtKeyboard(self) diff --git a/modules/bnporc/perso/messages.py b/modules/bnporc/perso/messages.py index 7af72fc7b4..39c6338cf4 100644 --- a/modules/bnporc/perso/messages.py +++ b/modules/bnporc/perso/messages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities.messages import Message, Thread from weboob.capabilities.base import NotLoaded from weboob.tools.capabilities.messages.genericArticle import try_drop_tree @@ -29,7 +29,7 @@ from lxml.html import make_links_absolute -class MessagesPage(BasePage): +class MessagesPage(Page): def iter_threads(self): table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1) for tr in table.xpath('./tr'): @@ -61,7 +61,7 @@ def iter_threads(self): yield thread -class MessagePage(BasePage): +class MessagePage(Page): def get_content(self): """ Get the message content. diff --git a/modules/bnporc/perso/transactions.py b/modules/bnporc/perso/transactions.py index b43f08d5b2..4b49686cb8 100644 --- a/modules/bnporc/perso/transactions.py +++ b/modules/bnporc/perso/transactions.py @@ -20,7 +20,7 @@ import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -48,7 +48,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistory(BasePage): +class AccountHistory(Page): def iter_operations(self): for tr in self.document.xpath('//table[@id="tableCompte"]//tr'): if len(tr.xpath('td[@class="debit"]')) == 0: diff --git a/modules/bnporc/perso/transfer.py b/modules/bnporc/perso/transfer.py index c568550550..fdbd6d6337 100644 --- a/modules/bnporc/perso/transfer.py +++ b/modules/bnporc/perso/transfer.py @@ -20,7 +20,7 @@ import re -from weboob.tools.browser import BasePage, BrowserPasswordExpired +from weboob.tools.browser import Page, BrowserPasswordExpired from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import TransferError @@ -33,7 +33,7 @@ def __init__(self, id, label, send_checkbox, receive_checkbox): self.receive_checkbox = receive_checkbox -class TransferPage(BasePage): +class TransferPage(Page): def on_loaded(self): for td in self.document.xpath('//td[@class="hdvon1"]'): if td.text and 'Vous avez atteint le seuil de' in td.text: @@ -88,7 +88,7 @@ def transfer(self, from_id, to_id, amount, reason): self.browser.submit() -class TransferConfirmPage(BasePage): +class TransferConfirmPage(Page): def on_loaded(self): for td in self.document.getroot().cssselect('td#size2'): raise TransferError(td.text.strip()) @@ -100,6 +100,6 @@ def on_loaded(self): return -class TransferCompletePage(BasePage): +class TransferCompletePage(Page): def get_id(self): return self.group_dict['id'] diff --git a/modules/bnporc/pro.py b/modules/bnporc/pro.py index 7a0c1ef2d4..c7a9e4d64a 100644 --- a/modules/bnporc/pro.py +++ b/modules/bnporc/pro.py @@ -24,12 +24,12 @@ from weboob.capabilities import NotAvailable from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from .perso.transactions import Transaction -class ProAccountsList(BasePage): +class ProAccountsList(Page): COL_LABEL = 1 COL_ID = 2 COL_BALANCE = 3 @@ -77,7 +77,7 @@ def get_list(self, pro=True): return accounts -class ProAccountHistory(BasePage): +class ProAccountHistory(Page): COL_DATE = 0 COL_LABEL = 1 COL_DEBIT = -2 diff --git a/modules/boursorama/pages/account_history.py b/modules/boursorama/pages/account_history.py index 5cd50bb875..580b249eb4 100644 --- a/modules/boursorama/pages/account_history.py +++ b/modules/boursorama/pages/account_history.py @@ -22,7 +22,7 @@ from urlparse import urlparse import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -40,7 +40,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistory(BasePage): +class AccountHistory(Page): def get_operations(self): for form in self.document.xpath('//form[@name="marques"]'): for tr in form.xpath('.//tbody/tr'): diff --git a/modules/boursorama/pages/accounts_list.py b/modules/boursorama/pages/accounts_list.py index 8ecbee251d..fd564f81a8 100644 --- a/modules/boursorama/pages/accounts_list.py +++ b/modules/boursorama/pages/accounts_list.py @@ -22,11 +22,11 @@ from decimal import Decimal from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class AccountsList(BasePage): +class AccountsList(Page): def on_loaded(self): pass diff --git a/modules/boursorama/pages/card_history.py b/modules/boursorama/pages/card_history.py index a271dd115c..5cb4db745e 100644 --- a/modules/boursorama/pages/card_history.py +++ b/modules/boursorama/pages/card_history.py @@ -21,7 +21,7 @@ import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -33,7 +33,7 @@ class Transaction(FrenchTransaction): ] -class CardHistory(BasePage): +class CardHistory(Page): def get_operations(self): for form in self.document.xpath('//form[@name="marques"]'): for tr in form.xpath('.//tbody/tr'): diff --git a/modules/boursorama/pages/login.py b/modules/boursorama/pages/login.py index e69834b848..db9bf28869 100644 --- a/modules/boursorama/pages/login.py +++ b/modules/boursorama/pages/login.py @@ -22,7 +22,7 @@ import hashlib import urllib -from weboob.tools.browser import BasePage, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrowserIncorrectPassword from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard @@ -73,7 +73,7 @@ def checksum(self, (x1, y1, x2, y2)): return hashlib.md5(s).hexdigest() -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): pass # for td in self.document.getroot().cssselect('td.LibelleErreur'): @@ -97,6 +97,6 @@ def login(self, login, password): self.browser.location(form.attrib['action'], urllib.urlencode(args), no_login=True) -class UpdateInfoPage(BasePage): +class UpdateInfoPage(Page): def on_loaded(self): raise BrowserIncorrectPassword('Please update your login credentials') diff --git a/modules/boursorama/pages/two_authentication.py b/modules/boursorama/pages/two_authentication.py index 04bba9627d..0fe861489c 100644 --- a/modules/boursorama/pages/two_authentication.py +++ b/modules/boursorama/pages/two_authentication.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrowserIncorrectPassword import urllib2 import re @@ -27,7 +27,7 @@ class BrowserAuthenticationCodeMaxLimit(BrowserIncorrectPassword): pass -class AuthenticationPage(BasePage): +class AuthenticationPage(Page): MAX_LIMIT = "vous avez atteint le nombre maximum "\ "d'utilisation de l'authentification forte." diff --git a/modules/bouygues/pages/compose.py b/modules/bouygues/pages/compose.py index eef4ffd582..dcbe38d77f 100644 --- a/modules/bouygues/pages/compose.py +++ b/modules/bouygues/pages/compose.py @@ -21,10 +21,10 @@ import re from weboob.capabilities.messages import CantSendMessage -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ComposeFrame(BasePage): +class ComposeFrame(Page): phone_regex = re.compile('^(\+33|0033|0)(6|7)(\d{8})$') def post_message(self, message): @@ -37,14 +37,14 @@ def post_message(self, message): self.browser.submit() -class ComposePage(BasePage): +class ComposePage(Page): pass -class ConfirmPage(BasePage): +class ConfirmPage(Page): def confirm(self): self.browser.location('http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/resultSendSMS.phtml') -class SentPage(BasePage): +class SentPage(Page): pass diff --git a/modules/bouygues/pages/login.py b/modules/bouygues/pages/login.py index 5b1ee80941..94dc4c27c0 100644 --- a/modules/bouygues/pages/login.py +++ b/modules/bouygues/pages/login.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form(name='code') self.browser['j_username'] = login @@ -29,7 +29,7 @@ def login(self, login, password): self.browser.submit() -class LoginSASPage(BasePage): +class LoginSASPage(Page): def login(self): self.browser.select_form(name='redirect') self.browser.submit() diff --git a/modules/bp/pages/accounthistory.py b/modules/bp/pages/accounthistory.py index 6e486801c3..50f37de79d 100644 --- a/modules/bp/pages/accounthistory.py +++ b/modules/bp/pages/accounthistory.py @@ -22,7 +22,7 @@ import re from weboob.tools.capabilities.bank.transactions import FrenchTransaction -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page class Transaction(FrenchTransaction): @@ -46,7 +46,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistory(BasePage): +class AccountHistory(Page): def get_next_link(self): for a in self.document.xpath('//a[@class="btn_crt"]'): txt = u''.join([txt.strip() for txt in a.itertext()]) @@ -105,7 +105,7 @@ def get_history(self, deferred=False): return operations -class CardsList(BasePage): +class CardsList(Page): def get_cards(self): cards = [] for tr in self.document.xpath('//table[@class="dataNum"]/tbody/tr'): diff --git a/modules/bp/pages/accountlist.py b/modules/bp/pages/accountlist.py index 308750eaeb..63b01dd99c 100644 --- a/modules/bp/pages/accountlist.py +++ b/modules/bp/pages/accountlist.py @@ -21,13 +21,13 @@ from decimal import Decimal from weboob.capabilities.bank import Account, AccountNotFound -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.misc import to_unicode from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.ordereddict import OrderedDict -class AccountList(BasePage): +class AccountList(Page): def on_loaded(self): self.accounts = OrderedDict() self.parse_table('comptes', Account.TYPE_CHECKING) diff --git a/modules/bp/pages/login.py b/modules/bp/pages/login.py index c3f17c3528..829d52fae1 100644 --- a/modules/bp/pages/login.py +++ b/modules/bp/pages/login.py @@ -23,7 +23,7 @@ import re import lxml.etree as etree -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable from weboob.tools.captcha.virtkeyboard import VirtKeyboard @@ -33,7 +33,7 @@ def md5(f): return md5.hexdigest() -class UnavailablePage(BasePage): +class UnavailablePage(Page): def on_loaded(self): raise BrowserUnavailable() @@ -85,7 +85,7 @@ def get_symbol_coords(self, (x1, y1, x2, y2)): # strip borders return VirtKeyboard.get_symbol_coords(self, (x1+3, y1+3, x2-3, y2-3)) -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, pwd): vk = Keyboard(self) @@ -96,24 +96,24 @@ def login(self, login, pwd): self.browser.submit() -class repositionnerCheminCourant(BasePage): +class repositionnerCheminCourant(Page): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/initialiser-identif.ea") -class Initident(BasePage): +class Initident(Page): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/verifierMotDePasse-identif.ea") -class CheckPassword(BasePage): +class CheckPassword(Page): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/comptesCommun/synthese_assurancesEtComptes/init-synthese.ea") -class BadLoginPage(BasePage): +class BadLoginPage(Page): pass -class AccountDesactivate(BasePage): +class AccountDesactivate(Page): pass diff --git a/modules/bp/pages/transfer.py b/modules/bp/pages/transfer.py index 1343911089..8731cc95a2 100644 --- a/modules/bp/pages/transfer.py +++ b/modules/bp/pages/transfer.py @@ -21,11 +21,11 @@ import re from weboob.capabilities.bank import TransferError -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.misc import to_unicode -class TransferChooseAccounts(BasePage): +class TransferChooseAccounts(Page): def set_accouts(self, from_account, to_account): self.browser.select_form(name="AiguillageForm") self.browser["idxCompteEmetteur"] = [from_account.id] @@ -33,19 +33,19 @@ def set_accouts(self, from_account, to_account): self.browser.submit() -class CompleteTransfer(BasePage): +class CompleteTransfer(Page): def complete_transfer(self, amount): self.browser.select_form(name="virement_unitaire_saisie_saisie_virement_sepa") self.browser["montant"] = str(amount) self.browser.submit() -class TransferConfirm(BasePage): +class TransferConfirm(Page): def confirm(self): self.browser.location('https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virement/virementSafran_national/confirmerVirementNational-virementNational.ea') -class TransferSummary(BasePage): +class TransferSummary(Page): def get_transfer_id(self): p = self.document.xpath("//div[@id='main']/div/p")[0] diff --git a/modules/bred/pages.py b/modules/bred/pages.py index f4db5a6f58..268a27c40e 100644 --- a/modules/bred/pages.py +++ b/modules/bred/pages.py @@ -25,14 +25,14 @@ from decimal import Decimal, InvalidOperation import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.misc import to_unicode from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): try: length = int(self.document.xpath('//input[@id="pass"]')[0].attrib['maxlength']) @@ -52,7 +52,7 @@ def login(self, login, passwd): self.browser.submit(nologin=True) -class LoginResultPage(BasePage): +class LoginResultPage(Page): def on_loaded(self): for script in self.document.xpath('//script'): text = script.text @@ -113,11 +113,11 @@ def get_error(self): return error.text.strip() -class EmptyPage(BasePage): +class EmptyPage(Page): pass -class BredBasePage(BasePage): +class BredBasePage(Page): def js2args(self, s): cur_arg = None args = {} @@ -207,7 +207,7 @@ class Transaction(FrenchTransaction): ] -class TransactionsPage(BasePage): +class TransactionsPage(Page): def get_history(self, is_coming=None): last_debit = None transactions = [] diff --git a/modules/btdigg/pages/index.py b/modules/btdigg/pages/index.py index c5a4d55389..94f58688a4 100644 --- a/modules/btdigg/pages/index.py +++ b/modules/btdigg/pages/index.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class IndexPage(BasePage): +class IndexPage(Page): pass diff --git a/modules/btdigg/pages/torrents.py b/modules/btdigg/pages/torrents.py index 24ff0f9c1c..4fc9a84233 100644 --- a/modules/btdigg/pages/torrents.py +++ b/modules/btdigg/pages/torrents.py @@ -4,12 +4,12 @@ from urlparse import urlparse, parse_qs from weboob.tools.misc import get_bytes_size -from weboob.tools.browser import BasePage,BrokenPageError +from weboob.tools.browser import Page,BrokenPageError from weboob.capabilities.torrent import Torrent, MagnetOnly from weboob.capabilities.base import NotAvailable -class TorrentsPage(BasePage): +class TorrentsPage(Page): def iter_torrents(self): try: @@ -50,7 +50,7 @@ def iter_torrents(self): torrent.date = date yield torrent -class TorrentPage(BasePage): +class TorrentPage(Page): def get_torrent(self, id): trs = self.document.getroot().cssselect('table.torrent_info_tbl tr') diff --git a/modules/btmon/pages.py b/modules/btmon/pages.py index d5a4ca7fb9..fb2f7a6338 100644 --- a/modules/btmon/pages.py +++ b/modules/btmon/pages.py @@ -22,11 +22,11 @@ from weboob.capabilities.torrent import Torrent from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.misc import get_bytes_size -class TorrentsPage(BasePage): +class TorrentsPage(Page): def iter_torrents(self): for div in self.parser.select(self.document.getroot(),'div.list_tor'): name = NotAvailable @@ -63,7 +63,7 @@ def iter_torrents(self): yield torrent -class TorrentPage(BasePage): +class TorrentPage(Page): def get_torrent(self): seed = 0 leech = 0 diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index 5609143854..20d5ea2b74 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -26,13 +26,13 @@ from weboob.tools.mech import ClientForm from weboob.tools.ordereddict import OrderedDict -from weboob.tools.browser import BasePage, BrokenPageError, BrowserUnavailable, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrokenPageError, BrowserUnavailable, BrowserIncorrectPassword from weboob.capabilities import NotAvailable from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class _LogoutPage(BasePage): +class _LogoutPage(Page): def on_loaded(self): try: raise BrowserIncorrectPassword(self.parser.tocleanstring(self.parser.select(self.document.getroot(), '.messErreur', 1))) @@ -83,7 +83,7 @@ def login3(self, passwd): class ErrorPage(_LogoutPage): pass -class UnavailablePage(BasePage): +class UnavailablePage(Page): def on_loaded(self): try: raise BrowserUnavailable(self.parser.select(self.document.getroot(), 'div#message_error_hs', 1).text.strip()) @@ -116,7 +116,7 @@ class Transaction(FrenchTransaction): ] -class IndexPage(BasePage): +class IndexPage(Page): ACCOUNT_TYPES = {u'Epargne liquide': Account.TYPE_SAVINGS, u'Compte Courant': Account.TYPE_CHECKING, u'Mes comptes': Account.TYPE_CHECKING, diff --git a/modules/canalplus/pages.py b/modules/canalplus/pages.py index ae993bcfa2..184e1d5b32 100644 --- a/modules/canalplus/pages.py +++ b/modules/canalplus/pages.py @@ -20,7 +20,7 @@ from datetime import datetime import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.collection import Collection from weboob.capabilities.base import NotAvailable, NotLoaded from weboob.capabilities.image import BaseImage @@ -28,7 +28,7 @@ from .video import CanalplusVideo -class ChannelsPage(BasePage): +class ChannelsPage(Page): def get_channels(self): """ Extract all possible channels (paths) from the page @@ -55,7 +55,7 @@ def _clean_name(self, name): return friendly_id, name -class VideoPage(BasePage): +class VideoPage(Page): def parse_video(self, el, video=None): _id = el.find('ID').text if _id == '-1': diff --git a/modules/cappedtv/browser.py b/modules/cappedtv/browser.py index f676bc23ff..2803eae78d 100644 --- a/modules/cappedtv/browser.py +++ b/modules/cappedtv/browser.py @@ -13,7 +13,7 @@ import datetime from weboob.capabilities.base import NotAvailable from weboob.tools.misc import to_unicode -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.browser import BrokenPageError from weboob.tools.browser import BaseBrowser from weboob.tools.browser.decorators import id2url @@ -37,7 +37,7 @@ def id2url(cls, _id): # parser for search pages -class IndexPage(BasePage): +class IndexPage(Page): def iter_videos(self): # When no results are found, the website returns random results sb = self.parser.select(self.document.getroot(), 'div.search form input.searchbox', 1) @@ -85,7 +85,7 @@ def iter_videos(self): # parser for the video page -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video=None): _id = to_unicode(self.group_dict['id']) if video is None: diff --git a/modules/champslibres/pages.py b/modules/champslibres/pages.py index ec83d2247b..b00cfc7b7c 100644 --- a/modules/champslibres/pages.py +++ b/modules/champslibres/pages.py @@ -19,16 +19,16 @@ from datetime import date from weboob.capabilities.library import Book, Renew -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.mech import ClientForm from weboob.tools.html import html2text -class SkipPage(BasePage): +class SkipPage(Page): pass -class HomePage(BasePage): +class HomePage(Page): def on_loaded(self): link = self.document.find('//a[@id="patronRSSFeedLinkComponent"]') self.id = link.attrib['href'].split('/')[4] @@ -42,7 +42,7 @@ def txt2date(s): return date(int(split[2]) + 2000, int(split[1]), int(split[0])) -class RentedPage(BasePage): +class RentedPage(Page): def get_list(self): for tr in self.document.getroot().xpath('//tr[@class="patFuncEntry"]'): id = tr.xpath('td/input')[0].attrib["value"] @@ -77,16 +77,16 @@ def read_renew(self, id): return renew -class HistoryPage(BasePage): +class HistoryPage(Page): pass -class BookedPage(BasePage): +class BookedPage(Page): # TODO: book some books... pass -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(nr=0) self.browser.form.set_all_readonly(False) diff --git a/modules/chronopost/pages.py b/modules/chronopost/pages.py index 8e06e4cabe..c198149c07 100644 --- a/modules/chronopost/pages.py +++ b/modules/chronopost/pages.py @@ -23,16 +23,16 @@ from weboob.capabilities.parcel import Parcel, Event from weboob.capabilities import NotAvailable -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class IndexPage(BasePage): +class IndexPage(Page): def track_package(self, _id): self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'suivreEnvoi') self.browser['chronoNumbers'] = _id.encode('utf-8') self.browser.submit() -class TrackPage(BasePage): +class TrackPage(Page): def get_info(self, id): if len(self.document.xpath('//libelle[@nom="MSG_AUCUN_EVT"]')) > 0: return None diff --git a/modules/cic/pages.py b/modules/cic/pages.py index bbe6719f07..c9ee1f796b 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -24,14 +24,14 @@ import re from dateutil.relativedelta import relativedelta -from weboob.tools.browser import BasePage, BrowserIncorrectPassword, BrokenPageError +from weboob.tools.browser import Page, BrowserIncorrectPassword, BrokenPageError from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.date import parse_french_date -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(name='ident') self.browser['_cm_user'] = login.encode(self.browser.ENCODING) @@ -39,35 +39,35 @@ def login(self, login, passwd): self.browser.submit(nologin=True) -class LoginErrorPage(BasePage): +class LoginErrorPage(Page): pass -class ChangePasswordPage(BasePage): +class ChangePasswordPage(Page): def on_loaded(self): raise BrowserIncorrectPassword('Please change your password') -class VerifCodePage(BasePage): +class VerifCodePage(Page): def on_loaded(self): raise BrowserIncorrectPassword('Unable to login: website asks a code from a card') -class InfoPage(BasePage): +class InfoPage(Page): pass -class EmptyPage(BasePage): +class EmptyPage(Page): pass -class TransfertPage(BasePage): +class TransfertPage(Page): pass -class UserSpacePage(BasePage): +class UserSpacePage(Page): pass -class AccountsPage(BasePage): +class AccountsPage(Page): TYPES = {'C/C': Account.TYPE_CHECKING, 'Livret': Account.TYPE_SAVINGS, 'Pret': Account.TYPE_LOAN, @@ -165,7 +165,7 @@ class Transaction(FrenchTransaction): _is_coming = False -class OperationsPage(BasePage): +class OperationsPage(Page): def get_history(self): index = 0 for tr in self.document.getiterator('tr'): diff --git a/modules/citelis/pages.py b/modules/citelis/pages.py index ca4e6ea8f8..cf37192e7e 100644 --- a/modules/citelis/pages.py +++ b/modules/citelis/pages.py @@ -22,7 +22,7 @@ import datetime import re -from weboob.tools.browser import BasePage, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrowserIncorrectPassword from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -36,7 +36,7 @@ def clean_amount(cls, text): return FrenchTransaction.clean_amount(text) -class LoginPage(BasePage): +class LoginPage(Page): def login(self, merchant_id, login, password): self.browser.select_form(name='loginForm') self.browser['merchant'] = merchant_id.encode(self.browser.ENCODING) @@ -45,7 +45,7 @@ def login(self, merchant_id, login, password): self.browser.submit() -class SummaryPage(BasePage): +class SummaryPage(Page): def clean_amount(self, el, debit): amount = Decimal(Transaction.clean_amount(el.text_content())) if amount == Decimal('0.00'): @@ -66,13 +66,13 @@ def get_balance(self): return amount -class UselessPage(BasePage): +class UselessPage(Page): def on_loaded(self): for error in self.document.xpath('//li[@class="error"]'): raise BrowserIncorrectPassword(self.parser.tocleanstring(error)) -class TransactionSearchPage(BasePage): +class TransactionSearchPage(Page): def search(self, accepted=True, refused=False): self.browser.select_form(name='transactionSearchForm') self.browser['selectedDateCriteria'] = ['thisweek'] # TODO ask for more @@ -86,14 +86,14 @@ def search(self, accepted=True, refused=False): self.browser.submit() -class TransactionsPage(BasePage): +class TransactionsPage(Page): def get_csv_url(self): for a in self.parser.select(self.document.getroot(), '.exportlinks a'): if len(self.parser.select(a, 'span.csv')): return a.attrib['href'] -class TransactionsCsvPage(BasePage): +class TransactionsCsvPage(Page): def guess_format(self, amount): if re.search(r'\d\.\d\d$', amount): date_format = "%m/%d/%Y" diff --git a/modules/cmso/pages.py b/modules/cmso/pages.py index 048cd7c4b0..9339372b5c 100644 --- a/modules/cmso/pages.py +++ b/modules/cmso/pages.py @@ -22,12 +22,12 @@ from decimal import Decimal import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(name='formIdentification') self.browser['noPersonne'] = login.encode(self.browser.ENCODING) @@ -35,7 +35,7 @@ def login(self, login, passwd): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): def get_list(self): names = set() for li in self.document.xpath('//div[@class="affichMontant"]/ul/li/a'): @@ -70,7 +70,7 @@ class Transaction(FrenchTransaction): ] -class TransactionsPage(BasePage): +class TransactionsPage(Page): months = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre'] def get_next_link(self): diff --git a/modules/colisprive/pages.py b/modules/colisprive/pages.py index 943c417221..9d3e81ce40 100644 --- a/modules/colisprive/pages.py +++ b/modules/colisprive/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . from datetime import date -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.parcel import Parcel, Event @@ -26,7 +26,7 @@ def update_status(p, status): if p.status < status: p.status = status -class TrackPage(BasePage): +class TrackPage(Page): def get_info(self, _id): p = Parcel(_id) @@ -70,5 +70,5 @@ def get_info(self, _id): pass return p -class ErrorPage(BasePage): +class ErrorPage(Page): pass diff --git a/modules/cragr/mobile/pages/base.py b/modules/cragr/mobile/pages/base.py index bf969c9e65..e8b33381cc 100644 --- a/modules/cragr/mobile/pages/base.py +++ b/modules/cragr/mobile/pages/base.py @@ -18,11 +18,11 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.browser import BrowserUnavailable -class CragrBasePage(BasePage): +class CragrBasePage(Page): def on_loaded(self): # Check for an error for div in self.document.getiterator('div'): diff --git a/modules/cragr/web/pages.py b/modules/cragr/web/pages.py index 480c0791d4..c8b67189f7 100644 --- a/modules/cragr/web/pages.py +++ b/modules/cragr/web/pages.py @@ -22,11 +22,11 @@ from weboob.tools.date import parse_french_date from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction -class HomePage(BasePage): +class HomePage(Page): def get_post_url(self): for script in self.document.xpath('//script'): text = script.text @@ -39,7 +39,7 @@ def get_post_url(self): return None -class LoginPage(BasePage): +class LoginPage(Page): def login(self, password): assert password.isdigit() assert len(password) == 6 @@ -60,13 +60,13 @@ def login(self, password): def get_result_url(self): return self.parser.tocleanstring(self.document.getroot()) -class UselessPage(BasePage): +class UselessPage(Page): pass -class LoginErrorPage(BasePage): +class LoginErrorPage(Page): pass -class _AccountsPage(BasePage): +class _AccountsPage(Page): COL_LABEL = 0 COL_ID = 2 COL_VALUE = 4 @@ -121,7 +121,7 @@ def cards_pages(self): return links -class CardsPage(BasePage): +class CardsPage(Page): def get_list(self): TABLE_XPATH = '//table[caption[@class="caption tdb-cartes-caption" or @class="ca-table caption"]]' @@ -229,7 +229,7 @@ class AccountsPage(_AccountsPage): class SavingsPage(_AccountsPage): COL_ID = 1 -class TransactionsPage(BasePage): +class TransactionsPage(Page): def get_next_url(self): links = self.document.xpath('//span[@class="pager"]/a[@class="liennavigationcorpspage"]') if len(links) < 1: diff --git a/modules/creditcooperatif/perso/pages.py b/modules/creditcooperatif/perso/pages.py index aa15a57f51..3a9224dba7 100644 --- a/modules/creditcooperatif/perso/pages.py +++ b/modules/creditcooperatif/perso/pages.py @@ -22,12 +22,12 @@ import re from weboob.tools.json import json -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'AuthForm') self.browser['j_username'] = login.encode('iso-8859-15') @@ -35,7 +35,7 @@ def login(self, login, password): self.browser.submit(nologin=True) -class LoggedPage(BasePage): +class LoggedPage(Page): def get_error(self): div = self.document.xpath('//div[@class="errorForm-msg"]') if len(div) == 0: @@ -45,7 +45,7 @@ def get_error(self): return re.sub('[\r\n\t\xa0]+', ' ', msg) -class AccountsPage(BasePage): +class AccountsPage(Page): ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} def get_list(self): @@ -89,11 +89,11 @@ class Transaction(FrenchTransaction): ] -class TransactionsPage(BasePage): +class TransactionsPage(Page): pass -class TransactionsJSONPage(BasePage): +class TransactionsJSONPage(Page): ROW_DATE = 0 ROW_TEXT = 2 ROW_CREDIT = -1 @@ -109,7 +109,7 @@ def get_transactions(self): yield t -class ComingTransactionsPage(BasePage): +class ComingTransactionsPage(Page): ROW_REF = 0 ROW_TEXT = 1 ROW_DATE = 2 diff --git a/modules/creditcooperatif/pro/pages.py b/modules/creditcooperatif/pro/pages.py index 28a1f2f07a..1b9ffae746 100644 --- a/modules/creditcooperatif/pro/pages.py +++ b/modules/creditcooperatif/pro/pages.py @@ -22,12 +22,12 @@ import re import time -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, pin, strong_auth): form_nb = 1 if strong_auth else 0 indentType = "RENFORCE" if strong_auth else "MDP" @@ -40,7 +40,7 @@ def login(self, login, pin, strong_auth): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} CPT_ROW_ID = 0 @@ -95,7 +95,7 @@ class Transaction(FrenchTransaction): FrenchTransaction.TYPE_UNKNOWN), ] -class ITransactionsPage(BasePage): +class ITransactionsPage(Page): def get_next_url(self): # can be 'Suivant' or ' Suivant' next = self.document.xpath("//a[normalize-space(text()) = 'Suivant']") diff --git a/modules/creditdunord/pages.py b/modules/creditdunord/pages.py index 0cd53dfe01..6dcd7e8dc1 100644 --- a/modules/creditdunord/pages.py +++ b/modules/creditdunord/pages.py @@ -23,18 +23,18 @@ import re from cStringIO import StringIO -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.json import json from weboob.capabilities.bank import Account from weboob.capabilities import NotAvailable from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): pass -class CDNBasePage(BasePage): +class CDNBasePage(Page): def get_from_js(self, pattern, end, is_list=False): """ find a pattern in any javascript text diff --git a/modules/cuisineaz/pages.py b/modules/cuisineaz/pages.py index 063e790f3b..37f7615f95 100644 --- a/modules/cuisineaz/pages.py +++ b/modules/cuisineaz/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ResultsPage(BasePage): +class ResultsPage(Page): """ Page which contains results as a list of recipies """ def iter_recipes(self): @@ -71,7 +71,7 @@ def iter_recipes(self): yield recipe -class RecipePage(BasePage): +class RecipePage(Page): """ Page which contains a recipe """ def get_recipe(self, id): diff --git a/modules/dailymotion/pages.py b/modules/dailymotion/pages.py index e3404650bf..11ddab4dcc 100644 --- a/modules/dailymotion/pages.py +++ b/modules/dailymotion/pages.py @@ -27,13 +27,13 @@ from weboob.capabilities import NotAvailable from weboob.capabilities.image import BaseImage from weboob.tools.html import html2text -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from .video import DailymotionVideo -class IndexPage(BasePage): +class IndexPage(Page): def iter_videos(self): for div in self.parser.select(self.document.getroot(), 'div.sd_video_listitem'): smalldiv = self.parser.select(div, 'div.sd_video_previewtwig', 1) @@ -82,7 +82,7 @@ def get_rate(self, div): return 0 -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video=None): if video is None: video = DailymotionVideo(self.group_dict['id']) diff --git a/modules/delubac/pages.py b/modules/delubac/pages.py index 77053b0b7e..8fec3866f5 100644 --- a/modules/delubac/pages.py +++ b/modules/delubac/pages.py @@ -22,11 +22,11 @@ import re from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(name="frmLogin") self.browser['username'] = username.encode('utf-8') @@ -36,7 +36,7 @@ def login(self, username, password): self.browser.submit(nologin=True) -class DashboardPage(BasePage): +class DashboardPage(Page): def iter_accounts(self): for line in self._accounts(): yield self._get_account(line) @@ -67,7 +67,7 @@ def get_field(field): return account -class OperationsPage(BasePage): +class OperationsPage(Page): _LINE_XPATH = '//tr[starts-with(@class,"PL_LIGLST_")]' _NEXT_XPATH = '//a[contains(@class,"pg_next")]/@href' diff --git a/modules/dlfp/pages/board.py b/modules/dlfp/pages/board.py index 9bf60ad401..f95503b4e5 100644 --- a/modules/dlfp/pages/board.py +++ b/modules/dlfp/pages/board.py @@ -21,7 +21,7 @@ import re from logging import warning -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page class Message(object): @@ -43,7 +43,7 @@ def __init__(self, id, timestamp, login, message, is_me): warning('Unable to parse timestamp "%s"' % timestamp) -class BoardIndexPage(BasePage): +class BoardIndexPage(Page): def is_logged(self): return True diff --git a/modules/dlfp/pages/index.py b/modules/dlfp/pages/index.py index 46d9097df5..f3ae76dc7b 100644 --- a/modules/dlfp/pages/index.py +++ b/modules/dlfp/pages/index.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class DLFPPage(BasePage): +class DLFPPage(Page): def is_logged(self): for form in self.document.getiterator('form'): if form.attrib.get('id', None) == 'new_account_sidebar': diff --git a/modules/edf/pages.py b/modules/edf/pages.py index 0c4b12b5a3..777c64a47c 100644 --- a/modules/edf/pages.py +++ b/modules/edf/pages.py @@ -22,12 +22,12 @@ import re import urllib from decimal import Decimal -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bill import Subscription, Detail, Bill base_url = "http://particuliers.edf.com/" -class EdfBasePage(BasePage): +class EdfBasePage(Page): def is_logged(self): return (u'Me déconnecter' in self.document.xpath('//a/text()')) \ or (self.document.xpath('//table[contains(@summary, "Informations sur mon")]')) diff --git a/modules/ehentai/pages.py b/modules/ehentai/pages.py index 19cc8c96bc..6712c7cf86 100644 --- a/modules/ehentai/pages.py +++ b/modules/ehentai/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text from weboob.capabilities.image import BaseImage @@ -28,7 +28,7 @@ from .gallery import EHentaiGallery -class LoginPage(BasePage): +class LoginPage(Page): def is_logged(self): success_p = self.document.xpath( '//p[text() = "Login Successful. You will be returned momentarily."]') @@ -38,11 +38,11 @@ def is_logged(self): return False -class HomePage(BasePage): +class HomePage(Page): pass -class IndexPage(BasePage): +class IndexPage(Page): def iter_galleries(self): lines = self.document.xpath('//table[@class="itg"]//tr[@class="gtr0" or @class="gtr1"]') for line in lines: @@ -52,7 +52,7 @@ def iter_galleries(self): yield EHentaiGallery(re.search('(?<=/g/)\d+/[\dabcdef]+', url).group(0), title=title) -class GalleryPage(BasePage): +class GalleryPage(Page): def image_pages(self): return self.document.xpath('//div[@class="gdtm"]//a/attribute::href') @@ -97,6 +97,6 @@ def fill_gallery(self, gallery): gallery.thumbnail.url = gallery.thumbnail.id -class ImagePage(BasePage): +class ImagePage(Page): def get_url(self): return self.document.xpath('//div[@class="sni"]/a/img/attribute::src')[0] diff --git a/modules/europarl/pages.py b/modules/europarl/pages.py index 999e65cff4..4b711275f2 100644 --- a/modules/europarl/pages.py +++ b/modules/europarl/pages.py @@ -21,7 +21,7 @@ from weboob.tools.mech import ClientForm ControlNotFoundError = ClientForm.ControlNotFoundError -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import re import datetime @@ -32,7 +32,7 @@ from .video import EuroparlVideo -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video=None): if video is None: video = EuroparlVideo(self.group_dict['id']) diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index 7549c6f5fe..5e007f4c60 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -24,7 +24,7 @@ from time import sleep from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrowserIncorrectPassword from weboob.capabilities import NotAvailable from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.json import json @@ -50,7 +50,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistoryPage(BasePage): +class AccountHistoryPage(Page): def get_operations(self, _id): """history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction""" @@ -83,7 +83,7 @@ def get_operations(self, _id): yield operation -class AccountsList(BasePage): +class AccountsList(Page): def on_loaded(self): warn = self.document.xpath('//div[@id="message_renouvellement_mot_passe"]') if len(warn) > 0: @@ -157,7 +157,7 @@ def get_list(self): yield account -class GlobalAccountsList(BasePage): +class GlobalAccountsList(Page): pass # vim:ts=4:sw=4 diff --git a/modules/fortuneo/pages/login.py b/modules/fortuneo/pages/login.py index cf8c80c4c2..88bf2405ce 100644 --- a/modules/fortuneo/pages/login.py +++ b/modules/fortuneo/pages/login.py @@ -20,10 +20,10 @@ #from logging import error -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): msgb = self.document.xpath(".//*[@id='message_client']/text()") msga = ''.join(msgb) diff --git a/modules/fourchan/pages/board.py b/modules/fourchan/pages/board.py index 863947f460..8f77b27b24 100644 --- a/modules/fourchan/pages/board.py +++ b/modules/fourchan/pages/board.py @@ -22,7 +22,7 @@ from datetime import datetime -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page class Message(object): @@ -47,7 +47,7 @@ def __repr__(self): return '' % (self.id, self.filename, self.url, len(self.comments)) -class BoardPage(BasePage): +class BoardPage(Page): URL_REGEXP = re.compile('http://boards.4chan.org/(\w+)/') def on_loaded(self): diff --git a/modules/ganassurances/pages.py b/modules/ganassurances/pages.py index e438c916c3..61311399e9 100644 --- a/modules/ganassurances/pages.py +++ b/modules/ganassurances/pages.py @@ -21,12 +21,12 @@ from decimal import Decimal import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(name='loginForm') self.browser.set_all_readonly(False) @@ -35,7 +35,7 @@ def login(self, login, passwd): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): ACCOUNT_TYPES = {u'Solde des comptes bancaires - Groupama Banque': Account.TYPE_CHECKING, u'Epargne bancaire constituée - Groupama Banque': Account.TYPE_SAVINGS, } @@ -88,7 +88,7 @@ class Transaction(FrenchTransaction): ] -class TransactionsPage(BasePage): +class TransactionsPage(Page): def get_history(self): count = 0 for tr in self.document.xpath('//table[@id="releve_operation"]/tr'): diff --git a/modules/gazelle/pages/base.py b/modules/gazelle/pages/base.py index fb1db9e7d8..804993b3ad 100644 --- a/modules/gazelle/pages/base.py +++ b/modules/gazelle/pages/base.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BrowserUnavailable, BasePage as _BasePage +from weboob.tools.browser import BrowserUnavailable, Page as _BasePage class BasePage(_BasePage): diff --git a/modules/gdcvault/pages.py b/modules/gdcvault/pages.py index 75c5628a37..6a33ee62a9 100644 --- a/modules/gdcvault/pages.py +++ b/modules/gdcvault/pages.py @@ -19,7 +19,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import urllib import re @@ -40,7 +40,7 @@ # TODO: check title on 1439 -class IndexPage(BasePage): +class IndexPage(Page): def iter_videos(self): for a in self.parser.select(self.document.getroot(), 'section.conference ul.media_items li.featured a.session_item'): href = a.attrib.get('href', '') @@ -79,7 +79,7 @@ def iter_videos(self): # the search page class uses a JSON parser, # since it's what search.php returns when POSTed (from Ajax) -class SearchPage(BasePage): +class SearchPage(Page): def iter_videos(self): if self.document is None or self.document['data'] is None: raise BrokenPageError('Unable to find JSON data') @@ -90,7 +90,7 @@ def iter_videos(self): continue yield video -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video=None): # check for slides id variant want_slides = False diff --git a/modules/gdfsuez/pages/history.py b/modules/gdfsuez/pages/history.py index 07fb5cec39..0b2bff9d27 100644 --- a/modules/gdfsuez/pages/history.py +++ b/modules/gdfsuez/pages/history.py @@ -26,12 +26,12 @@ from datetime import date from decimal import Decimal -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.base import NotAvailable from weboob.capabilities.bill import Detail, Bill -class HistoryPage(BasePage): +class HistoryPage(Page): def on_loaded(self): self.details = [] diff --git a/modules/gdfsuez/pages/homepage.py b/modules/gdfsuez/pages/homepage.py index e39fe2458c..0f42e17ec2 100644 --- a/modules/gdfsuez/pages/homepage.py +++ b/modules/gdfsuez/pages/homepage.py @@ -19,11 +19,11 @@ from datetime import date -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bill import Subscription -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form('symConnexionForm') @@ -32,13 +32,13 @@ def login(self, login, password): self.browser.submit() -class HomePage(BasePage): +class HomePage(Page): def on_loaded(self): pass -class AccountPage(BasePage): +class AccountPage(Page): def get_subscription_list(self): table = self.document.xpath('//table[@id="ensemble_contrat_N0"]')[0] @@ -63,7 +63,7 @@ def get_subscription_list(self): yield sub -class TimeoutPage(BasePage): +class TimeoutPage(Page): def on_loaded(self): pass diff --git a/modules/googletranslate/pages.py b/modules/googletranslate/pages.py index 2443b994c3..d850b4fb9a 100644 --- a/modules/googletranslate/pages.py +++ b/modules/googletranslate/pages.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class TranslatePage(BasePage): +class TranslatePage(Page): def get_translation(self): boxes = self.parser.select(self.document.getroot(), 'span#result_box', 1).findall('span') if len(boxes) == 0: diff --git a/modules/hds/pages.py b/modules/hds/pages.py index 7294515850..63f80455ca 100644 --- a/modules/hds/pages.py +++ b/modules/hds/pages.py @@ -21,14 +21,14 @@ import datetime import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ValidationPage(BasePage): +class ValidationPage(Page): pass -class HomePage(BasePage): +class HomePage(Page): pass @@ -55,7 +55,7 @@ def __init__(self, id): self.body = None -class HistoryPage(BasePage): +class HistoryPage(Page): def get_numerous(self): td = self.parser.select(self.document.getroot(), 'td.t0', 1) n = td.xpath('//u/strong|//u/b')[0].text @@ -91,7 +91,7 @@ def iter_stories(self): story = None -class StoryPage(BasePage): +class StoryPage(Page): def get_story(self): p_tags = self.document.getroot().xpath('//body/p') if len(p_tags) > 0 and p_tags[0].text.strip() == \ @@ -146,7 +146,7 @@ def get_story(self): return story -class AuthorPage(BasePage): +class AuthorPage(Page): def get_author(self): p_tags = self.document.getroot().xpath('//body/div/font/b') if len(p_tags) > 0 and p_tags[0].text.strip() == \ diff --git a/modules/hellobank/perso/accounts_list.py b/modules/hellobank/perso/accounts_list.py index 78ae0423ac..1284b310f1 100644 --- a/modules/hellobank/perso/accounts_list.py +++ b/modules/hellobank/perso/accounts_list.py @@ -22,11 +22,11 @@ from decimal import Decimal from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage, BrowserPasswordExpired +from weboob.tools.browser import Page, BrowserPasswordExpired from weboob.tools.json import json -class AccountsList(BasePage): +class AccountsList(Page): ACCOUNT_TYPES = { 1: Account.TYPE_CHECKING, 2: Account.TYPE_SAVINGS, diff --git a/modules/hellobank/perso/login.py b/modules/hellobank/perso/login.py index a573c45d88..9d35a8cd01 100644 --- a/modules/hellobank/perso/login.py +++ b/modules/hellobank/perso/login.py @@ -22,7 +22,7 @@ import time import re -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError @@ -70,7 +70,7 @@ def get_string_code(self, string): return code -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): for td in self.document.getroot().cssselect('td.LibelleErreur'): if td.text is None: @@ -93,7 +93,7 @@ def login(self, login, password): self.browser.submit() -class ConfirmPage(BasePage): +class ConfirmPage(Page): def get_error(self): for td in self.document.xpath('//td[@class="hdvon1"]'): if td.text: @@ -107,6 +107,6 @@ def get_relocate_url(self): return m.group(1) -class InfoMessagePage(BasePage): +class InfoMessagePage(Page): def on_loaded(self): pass diff --git a/modules/hellobank/perso/messages.py b/modules/hellobank/perso/messages.py index 7af72fc7b4..39c6338cf4 100644 --- a/modules/hellobank/perso/messages.py +++ b/modules/hellobank/perso/messages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities.messages import Message, Thread from weboob.capabilities.base import NotLoaded from weboob.tools.capabilities.messages.genericArticle import try_drop_tree @@ -29,7 +29,7 @@ from lxml.html import make_links_absolute -class MessagesPage(BasePage): +class MessagesPage(Page): def iter_threads(self): table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1) for tr in table.xpath('./tr'): @@ -61,7 +61,7 @@ def iter_threads(self): yield thread -class MessagePage(BasePage): +class MessagePage(Page): def get_content(self): """ Get the message content. diff --git a/modules/hellobank/perso/transactions.py b/modules/hellobank/perso/transactions.py index 8bc9eca987..4086e148fb 100644 --- a/modules/hellobank/perso/transactions.py +++ b/modules/hellobank/perso/transactions.py @@ -21,7 +21,7 @@ import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -45,7 +45,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistory(BasePage): +class AccountHistory(Page): def iter_operations(self): for tr in self.document.xpath('//table[@id="tableCompte"]//tr'): if len(tr.xpath('td[@class="debit"]')) == 0: diff --git a/modules/hellobank/perso/transfer.py b/modules/hellobank/perso/transfer.py index ac5391c9b3..2609684670 100644 --- a/modules/hellobank/perso/transfer.py +++ b/modules/hellobank/perso/transfer.py @@ -21,7 +21,7 @@ import re -from weboob.tools.browser import BasePage, BrowserPasswordExpired +from weboob.tools.browser import Page, BrowserPasswordExpired from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import TransferError @@ -34,7 +34,7 @@ def __init__(self, id, label, send_checkbox, receive_checkbox): self.receive_checkbox = receive_checkbox -class TransferPage(BasePage): +class TransferPage(Page): def on_loaded(self): for td in self.document.xpath('//td[@class="hdvon1"]'): if td.text and 'Vous avez atteint le seuil de' in td.text: @@ -91,7 +91,7 @@ def transfer(self, from_id, to_id, amount, reason): self.browser.submit() -class TransferConfirmPage(BasePage): +class TransferConfirmPage(Page): def on_loaded(self): for td in self.document.getroot().cssselect('td#size2'): raise TransferError(td.text.strip()) @@ -103,6 +103,6 @@ def on_loaded(self): return -class TransferCompletePage(BasePage): +class TransferCompletePage(Page): def get_id(self): return self.group_dict['id'] diff --git a/modules/imdb/pages.py b/modules/imdb/pages.py index 5a0781558e..a3e1755b91 100644 --- a/modules/imdb/pages.py +++ b/modules/imdb/pages.py @@ -20,13 +20,13 @@ from weboob.capabilities.cinema import Person, Movie from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text from datetime import datetime import re -class ReleasePage(BasePage): +class ReleasePage(Page): ''' Page containing releases of a movie ''' def get_movie_releases(self, country_filter): @@ -54,7 +54,7 @@ def get_movie_releases(self, country_filter): return result -class BiographyPage(BasePage): +class BiographyPage(Page): ''' Page containing biography of a person ''' def get_biography(self): @@ -71,7 +71,7 @@ def get_biography(self): return bio -class MovieCrewPage(BasePage): +class MovieCrewPage(Page): ''' Page listing all the persons related to a movie ''' def iter_persons(self, role_filter=None): @@ -126,7 +126,7 @@ def iter_persons_ids(self): yield id -class PersonPage(BasePage): +class PersonPage(Page): ''' Page informing about a person It is used to build a Person instance and to get the movie list related to a person ''' diff --git a/modules/ina/pages/search.py b/modules/ina/pages/search.py index 7f53425d27..f210a5499a 100644 --- a/modules/ina/pages/search.py +++ b/modules/ina/pages/search.py @@ -21,13 +21,13 @@ import datetime import re -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.capabilities.image import BaseImage from ..video import InaVideo -class SearchPage(BasePage): +class SearchPage(Page): URL_REGEXP = re.compile(r'/(.+)/(.+)\.jpeg') def iter_videos(self): diff --git a/modules/ina/pages/video.py b/modules/ina/pages/video.py index e11b63bbba..5d7f8be187 100644 --- a/modules/ina/pages/video.py +++ b/modules/ina/pages/video.py @@ -23,12 +23,12 @@ from weboob.capabilities import NotAvailable from weboob.capabilities.image import BaseImage -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from ..video import InaVideo -class VideoPage(BasePage): +class VideoPage(Page): URL_REGEXP = re.compile('http://player.ina.fr/notices/(.+)\.mrss') def get_id(self): diff --git a/modules/izneo/module.py b/modules/izneo/module.py index eb270efdcd..154490370d 100644 --- a/modules/izneo/module.py +++ b/modules/izneo/module.py @@ -24,12 +24,12 @@ from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage from weboob.tools.json import json from weboob.tools.backend import Module -from weboob.tools.browser import BaseBrowser, BasePage +from weboob.tools.browser import BaseBrowser, Page __all__ = ['IzneoModule'] -class ReaderV2(BasePage): +class ReaderV2(Page): def get_ean(self): return self.document.xpath("//div[@id='viewer']/attribute::rel")[0] diff --git a/modules/jacquieetmichel/pages.py b/modules/jacquieetmichel/pages.py index 8e2323b73a..e26f6499c7 100644 --- a/modules/jacquieetmichel/pages.py +++ b/modules/jacquieetmichel/pages.py @@ -22,13 +22,13 @@ from weboob.capabilities.base import NotAvailable from weboob.capabilities.image import BaseImage -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.misc import to_unicode from .video import JacquieEtMichelVideo -class ResultsPage(BasePage): +class ResultsPage(Page): def iter_videos(self): for span in self.document.xpath('//ul[@id="list"]/li'): a = self.parser.select(span, 'a', 1) @@ -49,7 +49,7 @@ def iter_videos(self): yield video -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video=None): _id = to_unicode(self.group_dict['id']) if video is None: diff --git a/modules/jvmalin/pages.py b/modules/jvmalin/pages.py index d3a6bb7d13..b5a334dbc4 100644 --- a/modules/jvmalin/pages.py +++ b/modules/jvmalin/pages.py @@ -6,14 +6,14 @@ from weboob.capabilities.travel import RoadmapError from weboob.tools.misc import to_unicode from weboob.tools.mech import ClientForm -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page class RoadmapAmbiguity(RoadmapError): def __init__(self, error): RoadmapError.__init__(self, error) -class RoadmapSearchPage(BasePage): +class RoadmapSearchPage(Page): def search(self, departure, arrival, departure_time, arrival_time): match = -1 i = 0 @@ -46,7 +46,7 @@ def search(self, departure, arrival, departure_time, arrival_time): raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time)) self.browser.submit() -class RoadmapResultsPage(BasePage): +class RoadmapResultsPage(Page): def html_br_strip(self, text): return "".join([l.strip() for l in text.split("\n")]).strip().replace(' ', '%20') @@ -96,7 +96,7 @@ def resubmit_best_form(self): self.browser[propname] = [ propvalue ] self.browser.submit() -class RoadmapPage(BasePage): +class RoadmapPage(Page): def get_steps(self): errors = [] # for p in self.parser.select(self.document.getroot(), 'p.errors'): diff --git a/modules/kickass/pages.py b/modules/kickass/pages.py index 8eebc62cd4..dd08004a08 100644 --- a/modules/kickass/pages.py +++ b/modules/kickass/pages.py @@ -22,11 +22,11 @@ from weboob.capabilities.torrent import Torrent from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.misc import get_bytes_size -class TorrentsPage(BasePage): +class TorrentsPage(Page): def iter_torrents(self): for tr in self.document.getiterator('tr'): if tr.attrib.get('class', '') == 'odd' or tr.attrib.get('class', '') == ' even': @@ -70,7 +70,7 @@ def iter_torrents(self): yield torrent -class TorrentPage(BasePage): +class TorrentPage(Page): def get_torrent(self, id): seed = 0 leech = 0 diff --git a/modules/lacentrale/pages.py b/modules/lacentrale/pages.py index 86fbafd424..bf05c2ca98 100644 --- a/modules/lacentrale/pages.py +++ b/modules/lacentrale/pages.py @@ -21,13 +21,13 @@ from decimal import Decimal import re -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities import NotAvailable, NotLoaded from weboob.capabilities.pricecomparison import Product, Price, Shop # I manage main page, ie do nothing yet -class MainPage(BasePage): +class MainPage(Page): def iter_products(self, criteria): product = Product(1) # TODO check if criteria exists in main page @@ -59,7 +59,7 @@ def new_price(id, product, cost, title): # I manage listing page and extract information -class ListingAutoPage(BasePage): +class ListingAutoPage(Page): def _extract(self, tr, name): 'Extract content from td element with class name' @@ -107,7 +107,7 @@ def get_next(self): # I manage one car page (annonce) )and extract information -class AnnoncePage(BasePage): +class AnnoncePage(Page): def _extract(self, e, name): 'Extract content from li element with class name' diff --git a/modules/lcl/enterprise/pages.py b/modules/lcl/enterprise/pages.py index 03d8da69b0..ec29b8ffd3 100644 --- a/modules/lcl/enterprise/pages.py +++ b/modules/lcl/enterprise/pages.py @@ -20,37 +20,37 @@ from decimal import Decimal from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.capabilities.bank.transactions import FrenchTransaction from ..pages import Transaction -class RootPage(BasePage): +class RootPage(Page): pass -class LogoutPage(BasePage): +class LogoutPage(Page): pass -class LogoutOkPage(BasePage): +class LogoutOkPage(Page): pass -class MessagesPage(BasePage): +class MessagesPage(Page): pass -class AlreadyConnectedPage(BasePage): +class AlreadyConnectedPage(Page): pass -class ExpiredPage(BasePage): +class ExpiredPage(Page): pass -class MovementsPage(BasePage): +class MovementsPage(Page): def get_account(self): LABEL_XPATH = '//*[@id="perimetreMandatEnfantLib"]' BALANCE_XPATH = '//div[contains(text(),"Solde comptable :")]/strong' @@ -86,7 +86,7 @@ def get_operations(self): yield operation -class HomePage(BasePage): +class HomePage(Page): def login(self, login, passwd): p = lambda f: f.attrs.get('id') == "form_autoComplete" self.browser.select_form(predicate=p) diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index dfee9f948c..5d4b551dae 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -26,7 +26,7 @@ from weboob.capabilities.bank import Account -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardError from weboob.tools.capabilities.bank.transactions import FrenchTransaction @@ -67,11 +67,11 @@ def get_string_code(self,string): return code -class SkipPage(BasePage): +class SkipPage(Page): pass -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): try: self.browser.select_form(name='form') @@ -132,7 +132,7 @@ def is_error(self): errors = self.document.xpath(u'//div[@class="erreur" or @class="messError"]') return len(errors) > 0 -class ContractsPage(BasePage): +class ContractsPage(Page): def on_loaded(self): self.select_contract() @@ -143,7 +143,7 @@ def select_contract(self): self.browser.submit(nologin=True) -class AccountsPage(BasePage): +class AccountsPage(Page): def on_loaded(self): warn = self.document.xpath('//div[@id="attTxt"]') if len(warn) > 0: @@ -234,7 +234,7 @@ class Transaction(FrenchTransaction): ] -class AccountHistoryPage(BasePage): +class AccountHistoryPage(Page): def get_table(self): tables=self.document.findall("//table[@class='tagTab pyjama']") for table in tables: diff --git a/modules/leclercmobile/pages/history.py b/modules/leclercmobile/pages/history.py index f78433171f..b46c188544 100644 --- a/modules/leclercmobile/pages/history.py +++ b/modules/leclercmobile/pages/history.py @@ -26,7 +26,7 @@ from datetime import datetime, date, time from decimal import Decimal -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bill import Detail, Bill @@ -156,7 +156,7 @@ def get_calls(self): return sorted(details, key=_get_date, reverse=True) -class HistoryPage(BasePage): +class HistoryPage(Page): def on_loaded(self): pass diff --git a/modules/leclercmobile/pages/homepage.py b/modules/leclercmobile/pages/homepage.py index fc8dc3bbe6..e5565821fd 100644 --- a/modules/leclercmobile/pages/homepage.py +++ b/modules/leclercmobile/pages/homepage.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . from weboob.capabilities.bill import Subscription -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class HomePage(BasePage): +class HomePage(Page): def on_loaded(self): pass diff --git a/modules/leclercmobile/pages/login.py b/modules/leclercmobile/pages/login.py index 2e92f39f98..d44a4a95ee 100644 --- a/modules/leclercmobile/pages/login.py +++ b/modules/leclercmobile/pages/login.py @@ -18,11 +18,11 @@ # along with weboob. If not, see . import StringIO -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.mech import ClientForm -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): pass diff --git a/modules/lefigaro/browser.py b/modules/lefigaro/browser.py index a7e52e0829..ad899aec49 100644 --- a/modules/lefigaro/browser.py +++ b/modules/lefigaro/browser.py @@ -20,10 +20,10 @@ from .pages.article import ArticlePage, ActuPage from .pages.flashactu import FlashActuPage -from weboob.tools.browser import BaseBrowser, BasePage +from weboob.tools.browser import BaseBrowser, Page -class IndexPage(BasePage): +class IndexPage(Page): pass diff --git a/modules/lolix/pages.py b/modules/lolix/pages.py index d1ae4d46a6..22d993d4a5 100644 --- a/modules/lolix/pages.py +++ b/modules/lolix/pages.py @@ -18,14 +18,14 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import dateutil.parser import re from .job import LolixJobAdvert -class AdvertPage(BasePage): +class AdvertPage(Page): def get_job_advert(self, url, advert): tables = self.document.getroot().xpath('//td[@class="Contenu"]/table') rows = self.parser.select(tables[2], 'tr') @@ -66,7 +66,7 @@ def fill_job_advert(self, rows, advert): return advert -class SearchPage(BasePage): +class SearchPage(Page): def iter_job_adverts(self, pattern): rows = self.document.getroot().xpath('//td[@class="Contenu"]/table/tr') for row in rows: diff --git a/modules/lutim/pages.py b/modules/lutim/pages.py index bb0cbf4fdf..2cf454ac89 100644 --- a/modules/lutim/pages.py +++ b/modules/lutim/pages.py @@ -18,11 +18,11 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import re -class PageAll(BasePage): +class PageAll(Page): def post(self, name, content, max_days): pass diff --git a/modules/marmiton/pages.py b/modules/marmiton/pages.py index 56558b6e54..9ef383fd52 100644 --- a/modules/marmiton/pages.py +++ b/modules/marmiton/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ResultsPage(BasePage): +class ResultsPage(Page): """ Page which contains results as a list of recipies """ def iter_recipes(self): @@ -54,7 +54,7 @@ def iter_recipes(self): yield recipe -class RecipePage(BasePage): +class RecipePage(Page): """ Page which contains a recipe """ def get_recipe(self, id): diff --git a/modules/meteofrance/pages/meteo.py b/modules/meteofrance/pages/meteo.py index 2380610487..4e9736a0f8 100644 --- a/modules/meteofrance/pages/meteo.py +++ b/modules/meteofrance/pages/meteo.py @@ -19,14 +19,14 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.weather import Forecast, Current, City import datetime import re -class SearchCitiesPage(BasePage): +class SearchCitiesPage(Page): def iter_cities(self): list = self.document.getroot().xpath('//ul[@class="list-style-1"]/li/a') for a in list: @@ -36,7 +36,7 @@ def iter_cities(self): yield mcity -class WeatherPage(BasePage): +class WeatherPage(Page): def get_temp_without_unit(self, temp_str): # It seems that the mechanize module give us some old style # ISO character diff --git a/modules/monster/pages.py b/modules/monster/pages.py index 3ef8b9b749..77a2cfc2d9 100644 --- a/modules/monster/pages.py +++ b/modules/monster/pages.py @@ -18,14 +18,14 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.html import html2text import re from datetime import datetime, time, timedelta from .job import MonsterJobAdvert -class SearchPage(BasePage): +class SearchPage(Page): def iter_job_adverts(self): re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL) trs = self.document.getroot().xpath("//table[@class='listingsTable']/tbody/tr") @@ -58,7 +58,7 @@ def iter_job_adverts(self): yield advert -class AdvertPage(BasePage): +class AdvertPage(Page): def get_job_advert(self, url, advert): re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL) if advert is None: diff --git a/modules/nectarine/pages.py b/modules/nectarine/pages.py index c5b97e38b0..1bf8ad5246 100644 --- a/modules/nectarine/pages.py +++ b/modules/nectarine/pages.py @@ -17,13 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.radio import Radio from weboob.capabilities.audiostream import BaseAudioStream from weboob.tools.capabilities.streaminfo import StreamInfo -class StreamsPage(BasePage): +class StreamsPage(Page): def iter_radios_list(self): radio = Radio('necta') radio.title = u'Nectarine' @@ -48,7 +48,7 @@ def iter_radios_list(self): yield radio -class LivePage(BasePage): +class LivePage(Page): def get_current_emission(self): current = StreamInfo(0) current.who = unicode(self.document.xpath('//playlist/now/entry/artist')[0].text) diff --git a/modules/nettokom/pages/history.py b/modules/nettokom/pages/history.py index c48b051369..1ded0b3658 100644 --- a/modules/nettokom/pages/history.py +++ b/modules/nettokom/pages/history.py @@ -21,11 +21,11 @@ from datetime import datetime, date, time from decimal import Decimal -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.bill import Detail -class DetailsPage(BasePage): +class DetailsPage(Page): def on_loaded(self): self.details = [] @@ -54,12 +54,12 @@ def _get_date(detail): return detail.datetime -class BillsPage(BasePage): +class BillsPage(Page): def on_loaded(self): pass -class HistoryPage(BasePage): +class HistoryPage(Page): def on_loaded(self): self.calls = [] diff --git a/modules/nettokom/pages/homepage.py b/modules/nettokom/pages/homepage.py index e77f592bb2..ef0cf930d3 100644 --- a/modules/nettokom/pages/homepage.py +++ b/modules/nettokom/pages/homepage.py @@ -19,12 +19,12 @@ from weboob.capabilities.bill import Subscription from weboob.tools.capabilities.bank.transactions import FrenchTransaction -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from datetime import date from decimal import Decimal -class HomePage(BasePage): +class HomePage(Page): def on_loaded(self): pass diff --git a/modules/nettokom/pages/login.py b/modules/nettokom/pages/login.py index 99c0a11d7b..c66b542a19 100644 --- a/modules/nettokom/pages/login.py +++ b/modules/nettokom/pages/login.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): pass diff --git a/modules/nihonnooto/pages.py b/modules/nihonnooto/pages.py index d23c6772c9..8e035ba3be 100644 --- a/modules/nihonnooto/pages.py +++ b/modules/nihonnooto/pages.py @@ -17,13 +17,13 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.radio import Radio from weboob.capabilities.audiostream import BaseAudioStream from weboob.tools.capabilities.streaminfo import StreamInfo -class LivePage(BasePage): +class LivePage(Page): def iter_radios_list(self): radio = Radio('nihon') radio.title = u'Nihon no Oto' @@ -49,7 +49,7 @@ def iter_radios_list(self): yield radio -class ProgramPage(BasePage): +class ProgramPage(Page): def get_current_emission(self): current = StreamInfo(0) two_or_more = unicode(self.document.xpath('//p')[0].text).split('/////')[0].split(' - ') diff --git a/modules/nolifetv/pages.py b/modules/nolifetv/pages.py index 7d44bc3e24..6fa629a36d 100644 --- a/modules/nolifetv/pages.py +++ b/modules/nolifetv/pages.py @@ -21,7 +21,7 @@ from weboob.capabilities.collection import Collection from weboob.capabilities.image import BaseImage -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import re from datetime import datetime, timedelta @@ -29,7 +29,7 @@ from .video import NolifeTVVideo -class VideoPage(BasePage): +class VideoPage(Page): def get_video(self, video): if not video: video = NolifeTVVideo(self.group_dict['id']) @@ -67,7 +67,7 @@ def get_video(self, video): seconds=int(m.group(3))) return video -class VideoListPage(BasePage): +class VideoListPage(Page): def is_list_empty(self): return self.document.getroot() == None @@ -85,7 +85,7 @@ def iter_video(self, available_videos): video.title = video.title + ' - ' + strongs[3].text yield video -class FamilyPage(BasePage): +class FamilyPage(Page): def iter_category(self): subs = list() @@ -109,7 +109,7 @@ def iter_family(self, sub): if m and m.group(1): yield Collection([m.group(1)], unicode(h1.text)) -class AboPage(BasePage): +class AboPage(Page): def get_available_videos(self): available = ['[Gratuit]'] @@ -123,13 +123,13 @@ def get_available_videos(self): return available -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(name='login') self.browser['username'] = str(username) self.browser['password'] = str(password) self.browser.submit() -class HomePage(BasePage): +class HomePage(Page): def is_logged(self): return len(self.document.xpath('//a[@href="deconnexion/"]')) == 1 diff --git a/modules/okc/browser.py b/modules/okc/browser.py index 8644d65f40..eee1447808 100644 --- a/modules/okc/browser.py +++ b/modules/okc/browser.py @@ -19,7 +19,7 @@ import urllib -from weboob.tools.browser import BaseBrowser, BasePage +from weboob.tools.browser import BaseBrowser, Page from weboob.tools.ordereddict import OrderedDict from .pages import LoginPage, ThreadPage, MessagesPage, PostMessagePage, ProfilePage, PhotosPage, VisitsPage, QuickMatchPage, SentPage @@ -45,7 +45,7 @@ class OkCBrowser(BaseBrowser): ENCODING = 'UTF-8' PAGES = OrderedDict(( ('https://%s/login.*' % DOMAIN, LoginPage), - ('http://%s/home' % DOMAIN, BasePage), + ('http://%s/home' % DOMAIN, Page), ('http://%s/messages' % DOMAIN, ThreadPage), ('http://%s/messages\?compose=1' % DOMAIN, PostMessagePage), ('http://\w+.okcupid.com/messages\?.*', MessagesPage), diff --git a/modules/okc/pages.py b/modules/okc/pages.py index 639290c04a..c79e79c116 100644 --- a/modules/okc/pages.py +++ b/modules/okc/pages.py @@ -20,13 +20,13 @@ import re from datetime import datetime -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.contact import ProfileNode from weboob.tools.html import html2text from weboob.tools.date import local2utc -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(name='loginf') self.browser['username'] = username.encode(self.browser.ENCODING) @@ -34,7 +34,7 @@ def login(self, username, password): self.browser.submit(id='login_btn', nologin=True) -class ThreadPage(BasePage): +class ThreadPage(Page): def get_threads(self): li_elems = self.parser.select(self.document.getroot(), "//div[@id='page_content']//li", method= 'xpath') @@ -51,7 +51,7 @@ def get_threads(self): return threads -class MessagesPage(BasePage): +class MessagesPage(Page): def get_thread_mails(self): mails = { 'member' : {}, @@ -109,7 +109,7 @@ def get_post_params(self): raise Exception('Unexpected reply page') -class ProfilePage(BasePage): +class ProfilePage(Page): def get_visit_button_params(self): links = self.parser.select(self.document.getroot(), "//a", method='xpath') for a in links: @@ -178,20 +178,20 @@ def get_profile(self): return profile -class PhotosPage(BasePage): +class PhotosPage(Page): def get_photos(self): imgs = self.parser.select(self.document.getroot(), "//div[@class='pic clearfix']//img", method='xpath') return [unicode(img.get('src')) for img in imgs] -class PostMessagePage(BasePage): +class PostMessagePage(Page): def post_mail(self, id, content): self.browser.select_form(name='f2') self.browser['r1'] = id.encode('utf-8') self.browser['body'] = content.encode('utf-8') self.browser.submit() -class VisitsPage(BasePage): +class VisitsPage(Page): def get_visits(self): ul_item = self.parser.select(self.document.getroot(), '//*[@id="page_content"]/ul[3]', method='xpath')[0] visitors = [] @@ -206,7 +206,7 @@ def get_visits(self): }) return visitors -class QuickMatchPage(BasePage): +class QuickMatchPage(Page): def get_id(self): element = self.parser.select(self.document.getroot(), '//*[@id="sn"]', method='xpath')[0] visitor_id = unicode(element.get('value')) @@ -259,5 +259,5 @@ def get_rating_params(self): # var params = {voterid: CURRENTUSERID,target_userid: tuid,target_objectid: 0,type: vote_or_note,vote_type: vote_type,score: rating} -class SentPage(BasePage): +class SentPage(Page): pass diff --git a/modules/opacwebaloes/pages.py b/modules/opacwebaloes/pages.py index c801782d96..8a66f8af52 100644 --- a/modules/opacwebaloes/pages.py +++ b/modules/opacwebaloes/pages.py @@ -19,15 +19,15 @@ from datetime import date from weboob.capabilities.library import Book -from weboob.tools.browser import BasePage, BrowserUnavailable +from weboob.tools.browser import Page, BrowserUnavailable from weboob.tools.mech import ClientForm -class SkipPage(BasePage): +class SkipPage(Page): pass -class HomePage(BasePage): +class HomePage(Page): pass @@ -35,7 +35,7 @@ def txt2date(s): return date(*reversed([int(x) for x in s.split(' ')[-1].split('/')])) -class RentedPage(BasePage): +class RentedPage(Page): # TODO, table limited to 20 items, need to use pagination def get_list(self): for book in self.iter_books('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl07_COMPTE_PRET_1_1_GrillePrets_ctl00__")]', 1): @@ -55,11 +55,11 @@ def iter_books(self, el, start): yield book -class HistoryPage(BasePage): +class HistoryPage(Page): pass -class BookedPage(BasePage): +class BookedPage(Page): # TODO, table limited to 20 items, need to use pagination def get_list(self): for tr in self.document.getroot().xpath('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl09_COMPTE_INFOS_0_GrilleInfos_ctl00__0")]'): @@ -80,7 +80,7 @@ def get_list(self): yield book -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, passwd): self.browser.select_form(predicate=lambda x: x.attrs.get('id','')=='aspnetForm') self.browser.form.set_all_readonly(False) diff --git a/modules/opensubtitles/pages.py b/modules/opensubtitles/pages.py index f381ec6c1e..e14c9eada4 100644 --- a/modules/opensubtitles/pages.py +++ b/modules/opensubtitles/pages.py @@ -21,11 +21,11 @@ from weboob.capabilities.subtitle import Subtitle from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.applications.suboob.suboob import LANGUAGE_CONV -class SearchPage(BasePage): +class SearchPage(Page): """ Page which contains results as a list of movies """ def iter_subtitles(self): @@ -46,7 +46,7 @@ def iter_subtitles(self): yield subtitle -class SubtitlesPage(BasePage): +class SubtitlesPage(Page): """ Page which contains several subtitles for a single movie """ def iter_subtitles(self): @@ -99,7 +99,7 @@ def get_subtitle_from_line(self, line): return subtitle -class SubtitlePage(BasePage): +class SubtitlePage(Page): """ Page which contains a single subtitle for a movie """ def get_subtitle(self): diff --git a/modules/orange/pages/compose.py b/modules/orange/pages/compose.py index 71c06b7f3e..01b5482379 100644 --- a/modules/orange/pages/compose.py +++ b/modules/orange/pages/compose.py @@ -20,15 +20,15 @@ import re from weboob.capabilities.messages import CantSendMessage -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ConfirmPage(BasePage): +class ConfirmPage(Page): def on_loaded(self): pass -class ComposePage(BasePage): +class ComposePage(Page): phone_regex = re.compile('^(\+33|0033|0)(6|7)(\d{8})$') def on_loaded(self): diff --git a/modules/orange/pages/login.py b/modules/orange/pages/login.py index 516b241f3c..f433fc1679 100644 --- a/modules/orange/pages/login.py +++ b/modules/orange/pages/login.py @@ -17,11 +17,11 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import urllib -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): pass diff --git a/modules/ovs/pages.py b/modules/ovs/pages.py index 26645bc2b7..ebb4d4652e 100644 --- a/modules/ovs/pages.py +++ b/modules/ovs/pages.py @@ -22,7 +22,7 @@ import re import urllib from urlparse import urlsplit -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.messages import Message, Thread from weboob.capabilities.contact import Contact, ProfileNode from weboob.tools.date import parse_french_date @@ -30,7 +30,7 @@ import ovsparse -class OvsPage(BasePage): +class OvsPage(Page): def is_logged(self): return ovsparse.is_logged(self.document) @@ -143,7 +143,7 @@ def post_to_thread(self, thread_id, subject, body): #~ self.browser.submit() -class PageLogin(BasePage): +class PageLogin(Page): pass @@ -151,7 +151,7 @@ class PageIndex(OvsPage): pass -class DummyPage(BasePage): +class DummyPage(Page): pass diff --git a/modules/pap/pages.py b/modules/pap/pages.py index 3914b31ba1..f185013f6b 100644 --- a/modules/pap/pages.py +++ b/modules/pap/pages.py @@ -22,12 +22,12 @@ from decimal import Decimal from dateutil.parser import parse as parse_date -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.base import NotAvailable from weboob.capabilities.housing import Housing -class SearchResultsPage(BasePage): +class SearchResultsPage(Page): DATE_RE = re.compile('Annonce \w+ du (.*)') MONTHS = {u'janvier': 'january', u'février': 'february', @@ -86,7 +86,7 @@ def iter_housings(self): yield housing -class HousingPage(BasePage): +class HousingPage(Page): def get_housing(self): div = self.parser.select(self.document.getroot(), 'div#annonce_detail', 1) housing = Housing(self.url.split('-')[-1]) diff --git a/modules/pariskiwi/pages.py b/modules/pariskiwi/pages.py index 3fffead515..2b642c728d 100644 --- a/modules/pariskiwi/pages.py +++ b/modules/pariskiwi/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from datetime import datetime, time import json import lxml.html @@ -35,12 +35,12 @@ def id_from_path(title): def combine(dt, t): return datetime(dt.year, dt.month, dt.day, t.hour, t.minute) -class PageList(BasePage): +class PageList(Page): def get_events(self): raise NotImplementedError() -class PageList2(BasePage): +class PageList2(Page): def list_events(self): events = list(self.unsorted_list()) events.sort(key=lambda d: (d['date'], d['id'])) @@ -55,7 +55,7 @@ def unsorted_list(self): yield d -class PageEvent(BasePage): +class PageEvent(Page): def get_event(self): d = {} d['id'] = id_from_path(self.url) diff --git a/modules/parolesmania/pages.py b/modules/parolesmania/pages.py index 895ab23879..c3a25d0dfb 100644 --- a/modules/parolesmania/pages.py +++ b/modules/parolesmania/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.lyrics import SongLyrics from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ArtistResultsPage(BasePage): +class ArtistResultsPage(Page): def iter_lyrics(self): for link in self.parser.select(self.document.getroot(), 'div#albums > h1 a'): artist = unicode(link.text_content()) @@ -35,7 +35,7 @@ def iter_lyrics(self): yield lyr -class ArtistSongsPage(BasePage): +class ArtistSongsPage(Page): def iter_lyrics(self, artist=None): if artist is None: artist = self.parser.select(self.document.getroot(), 'head > title', 1).text.replace('Paroles ', '') @@ -52,7 +52,7 @@ def iter_lyrics(self, artist=None): yield songlyrics -class SongResultsPage(BasePage): +class SongResultsPage(Page): def iter_lyrics(self): for link in self.parser.select(self.document.getroot(), 'div#albums a'): artist = NotAvailable @@ -68,7 +68,7 @@ def iter_lyrics(self): yield songlyrics -class SonglyricsPage(BasePage): +class SonglyricsPage(Page): def get_lyrics(self, id): content = NotAvailable artist = NotAvailable diff --git a/modules/parolesmusique/pages.py b/modules/parolesmusique/pages.py index 0277054bbe..6e422fa0c8 100644 --- a/modules/parolesmusique/pages.py +++ b/modules/parolesmusique/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.lyrics import SongLyrics from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class HomePage(BasePage): +class HomePage(Page): def iter_lyrics(self, criteria, pattern): self.browser.select_form(name='rechercher') if criteria == 'artist': @@ -36,7 +36,7 @@ def iter_lyrics(self, criteria, pattern): yield lyr -class ArtistResultsPage(BasePage): +class ArtistResultsPage(Page): def iter_lyrics(self): for link in self.parser.select(self.document.getroot(), 'div.cont_cat table a.std'): artist = unicode(link.text_content()) @@ -46,7 +46,7 @@ def iter_lyrics(self): yield lyr -class ArtistSongsPage(BasePage): +class ArtistSongsPage(Page): def iter_lyrics(self, artist): for link in self.parser.select(self.document.getroot(), 'div.cont_catA div.art_scroll a'): href = link.attrib.get('href', '') @@ -59,7 +59,7 @@ def iter_lyrics(self, artist): yield songlyrics -class SongResultsPage(BasePage): +class SongResultsPage(Page): def iter_lyrics(self): first = True for tr in self.parser.select(self.document.getroot(), 'div.cont_cat table tr'): @@ -77,7 +77,7 @@ def iter_lyrics(self): yield songlyrics -class SonglyricsPage(BasePage): +class SonglyricsPage(Page): def get_lyrics(self, id): artist = NotAvailable title = NotAvailable diff --git a/modules/parolesnet/pages.py b/modules/parolesnet/pages.py index 5f9e02c995..6f33fd5f20 100644 --- a/modules/parolesnet/pages.py +++ b/modules/parolesnet/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.lyrics import SongLyrics from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class HomePage(BasePage): +class HomePage(Page): def iter_lyrics(self, criteria, pattern): self.browser.select_form(nr=0) self.browser['search'] = pattern @@ -33,7 +33,7 @@ def iter_lyrics(self, criteria, pattern): yield lyr -class ResultsPage(BasePage): +class ResultsPage(Page): def iter_lyrics(self, criteria): for link in self.parser.select(self.document.getroot(), 'div.box-content td.song-name a'): href = link.attrib.get('href','') @@ -57,7 +57,7 @@ def iter_lyrics(self, criteria): yield lyr -class ArtistSongsPage(BasePage): +class ArtistSongsPage(Page): def iter_lyrics(self): artist = unicode(self.parser.select(self.document.getroot(), 'span[itemprop=name]', 1).text) for link in self.parser.select(self.document.getroot(), 'td.song-name > p[itemprop=name] > a[itemprop=url]'): @@ -70,7 +70,7 @@ def iter_lyrics(self): yield songlyrics -class SonglyricsPage(BasePage): +class SonglyricsPage(Page): def get_lyrics(self, id): artist = NotAvailable title = NotAvailable diff --git a/modules/paypal/pages.py b/modules/paypal/pages.py index 1caa4051ab..f7432fe962 100644 --- a/modules/paypal/pages.py +++ b/modules/paypal/pages.py @@ -23,7 +23,7 @@ import dateutil.parser -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.parsers.csvparser import CsvParser from weboob.tools.misc import to_unicode from weboob.tools.date import parse_french_date @@ -39,7 +39,7 @@ def clean_amount(text): return Decimal(amnt) if amnt else Decimal("0") -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form(name='login_form') self.browser['login_email'] = login.encode(self.browser.ENCODING) @@ -47,7 +47,7 @@ def login(self, login, password): self.browser.submit(nologin=True) -class AccountPage(BasePage): +class AccountPage(Page): def get_account(self, _id): return self.get_accounts().get(_id) @@ -110,7 +110,7 @@ def get_accounts(self): return accounts -class DownloadHistoryPage(BasePage): +class DownloadHistoryPage(Page): def download(self, start, end): tr_last_file_request = self.document.xpath('//table//table//table//tr[2]//td')[1] if tr_last_file_request.text is not None: @@ -135,14 +135,14 @@ def download(self, start, end): self.browser.submit() -class LastDownloadHistoryPage(BasePage): +class LastDownloadHistoryPage(Page): def download(self): self.browser.select_form(nr=1) log_select = self.document.xpath('//table//form//input[@type="radio"]')[0].attrib['value'] self.browser['log_select'] = [log_select] self.browser.submit() -class SubmitPage(BasePage): +class SubmitPage(Page): """ Any result of form submission """ @@ -243,11 +243,11 @@ def decode_row(self, row, encoding): return [to_unicode(cell) for cell in row] -class UselessPage(BasePage): +class UselessPage(Page): pass -class HistoryPage(BasePage): +class HistoryPage(Page): def guess_format(self): rp = re.compile('PAYPAL\.widget\.CalendarLocales\.MDY_([A-Z]+)_POSITION\s*=\s*(\d)') rd = re.compile('PAYPAL\.widget\.CalendarLocales\.DATE_DELIMITER\s*=\s*"(.)"') diff --git a/modules/phpbb/pages/index.py b/modules/phpbb/pages/index.py index b41edbef34..8bd0c31e62 100644 --- a/modules/phpbb/pages/index.py +++ b/modules/phpbb/pages/index.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class PhpBBPage(BasePage): +class PhpBBPage(Page): def is_logged(self): return len(self.document.getroot().cssselect('li.icon-register')) == 0 diff --git a/modules/piratebay/pages/index.py b/modules/piratebay/pages/index.py index 9e93a36e2f..0445f35808 100644 --- a/modules/piratebay/pages/index.py +++ b/modules/piratebay/pages/index.py @@ -18,9 +18,9 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class IndexPage(BasePage): +class IndexPage(Page): def is_logged(self): return 'id' in self.document.find('body').attrib diff --git a/modules/piratebay/pages/torrents.py b/modules/piratebay/pages/torrents.py index 04f70fd97b..8b782d51ee 100644 --- a/modules/piratebay/pages/torrents.py +++ b/modules/piratebay/pages/torrents.py @@ -18,14 +18,14 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage,BrokenPageError +from weboob.tools.browser import Page,BrokenPageError from weboob.capabilities.torrent import Torrent from weboob.capabilities.base import NotAvailable, NotLoaded from html2text import unescape -class TorrentsPage(BasePage): +class TorrentsPage(Page): def unit(self, n, u): m = {'B': 1, 'KB': 1024, @@ -73,7 +73,7 @@ def iter_torrents(self): yield torrent -class TorrentPage(BasePage): +class TorrentPage(Page): def get_torrent(self, id): url = NotAvailable magnet = NotAvailable diff --git a/modules/pixtoilelibre/pages.py b/modules/pixtoilelibre/pages.py index b345b3280d..66d1003d7e 100644 --- a/modules/pixtoilelibre/pages.py +++ b/modules/pixtoilelibre/pages.py @@ -18,19 +18,19 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import re -class PageHome(BasePage): +class PageHome(Page): pass -class PageImage(BasePage): +class PageImage(Page): def get_info(self): id = re.search(r'img=([^&]+)', self.url).group(1) return {'url': self.url, 'id': id} -class PageError(BasePage): +class PageError(Page): pass diff --git a/modules/podnapisi/pages.py b/modules/podnapisi/pages.py index 04972d9493..ddf3a40561 100644 --- a/modules/podnapisi/pages.py +++ b/modules/podnapisi/pages.py @@ -20,7 +20,7 @@ from weboob.capabilities.subtitle import Subtitle from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page LANGUAGE_NUMBERS = { @@ -71,7 +71,7 @@ } -class SearchPage(BasePage): +class SearchPage(Page): """ Page which contains results as a list of movies """ def iter_subtitles(self, language): @@ -90,7 +90,7 @@ def iter_subtitles(self, language): yield subtitle -class SubtitlePage(BasePage): +class SubtitlePage(Page): """ Page which contains a single subtitle for a movie """ def get_subtitle(self, id): diff --git a/modules/popolemploi/pages.py b/modules/popolemploi/pages.py index 518e196654..436210eb04 100644 --- a/modules/popolemploi/pages.py +++ b/modules/popolemploi/pages.py @@ -18,14 +18,14 @@ # along with weboob. If not, see . from weboob.tools.html import html2text -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import dateutil.parser import re from .job import PopolemploiJobAdvert -class SearchPage(BasePage): +class SearchPage(Page): def iter_job_adverts(self): rows = self.document.getroot().xpath('//table[@class="definition-table ordered"]/tbody/tr') for row in rows: @@ -50,7 +50,7 @@ def create_job_advert(self, row): return advert -class AdvertPage(BasePage): +class AdvertPage(Page): def get_job_advert(self, url, advert): content = self.document.getroot().xpath('//div[@id="offre-body"]')[0] if not advert: diff --git a/modules/prixcarburants/pages.py b/modules/prixcarburants/pages.py index c101b4a8df..216ee27764 100644 --- a/modules/prixcarburants/pages.py +++ b/modules/prixcarburants/pages.py @@ -20,12 +20,12 @@ from decimal import Decimal -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities import NotAvailable from weboob.capabilities.pricecomparison import Product, Shop, Price -class IndexPage(BasePage): +class IndexPage(Page): def get_token(self): input = self.parser.select(self.document.getroot(), 'div#localisation input#recherche_recherchertype__token', 1) @@ -46,7 +46,7 @@ def iter_products(self): yield product -class ComparisonResultsPage(BasePage): +class ComparisonResultsPage(Page): def get_product_name(self): th = self.document.getroot().cssselect('table#tab_resultat tr th') if th and len(th) == 9: @@ -74,6 +74,6 @@ def iter_results(self, product=None): yield price -class ShopInfoPage(BasePage): +class ShopInfoPage(Page): def get_info(self): return self.parser.tostring(self.parser.select(self.document.getroot(), 'div.infos', 1)) diff --git a/modules/radiofrance/browser.py b/modules/radiofrance/browser.py index b23e233cc2..d765cbc125 100644 --- a/modules/radiofrance/browser.py +++ b/modules/radiofrance/browser.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.browser import BaseBrowser, BasePage +from weboob.tools.browser import BaseBrowser, Page from weboob.tools.json import json from weboob.capabilities.video import BaseVideo from weboob.tools.browser.decorators import id2url @@ -45,7 +45,7 @@ def id2url(cls, _id): (radio_domain, replay_id) -class PlayerPage(BasePage): +class PlayerPage(Page): URL = r'^http://www\.(?P%s)\.fr/player/reecouter\?play=(?P\d+)$' \ % '|'.join(RadioFranceVideo.RADIO_DOMAINS) MP3_REGEXP = re.compile(r'sites%2Fdefault.+.(?:MP3|mp3)') @@ -57,7 +57,7 @@ def get_url(self): return 'http://www.%s.fr/%s' % (radio_domain, urlparams['urlAOD'][0]) -class ReplayPage(BasePage): +class ReplayPage(Page): URL = r'^http://www\.(?P%s)\.fr/(?:emission|diffusion)-.+$' \ % '|'.join(RadioFranceVideo.RADIO_DOMAINS) # the url does not always end with id-yyy-mm-dd, sometimes no mm or dd @@ -88,7 +88,7 @@ def get_id(self): return (radio_domain, player_id) -class DataPage(BasePage): +class DataPage(Page): def get_current(self): document = self.document title = '' @@ -108,7 +108,7 @@ def get_current(self): return (artist, title) -class RssPage(BasePage): +class RssPage(Page): def get_title(self): titles = [] for heading in self.parser.select(self.document.getroot(), 'h1, h2, h3, h4'): diff --git a/modules/redmine/pages/index.py b/modules/redmine/pages/index.py index 3d146fca2a..3c366d8816 100644 --- a/modules/redmine/pages/index.py +++ b/modules/redmine/pages/index.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class LoginPage(BasePage): +class LoginPage(Page): def login(self, username, password): self.browser.select_form(predicate=lambda f: f.attrs.get('method', '') == 'post') self.browser['username'] = username.encode(self.browser.ENCODING) @@ -29,15 +29,15 @@ def login(self, username, password): self.browser.submit() -class IndexPage(BasePage): +class IndexPage(Page): pass -class MyPage(BasePage): +class MyPage(Page): pass -class ProjectsPage(BasePage): +class ProjectsPage(Page): def iter_projects(self): for ul in self.parser.select(self.document.getroot(), 'ul.projects'): for li in ul.findall('li'): diff --git a/modules/redmine/pages/issues.py b/modules/redmine/pages/issues.py index f130b52621..d9973e1a48 100644 --- a/modules/redmine/pages/issues.py +++ b/modules/redmine/pages/issues.py @@ -22,14 +22,14 @@ import datetime from weboob.capabilities.bugtracker import IssueError -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from weboob.tools.date import parse_french_date from weboob.tools.misc import to_unicode from weboob.tools.mech import ClientForm from weboob.tools.json import json -class BaseIssuePage(BasePage): +class BaseIssuePage(Page): def parse_datetime(self, text): m = re.match('(\d+)/(\d+)/(\d+) (\d+):(\d+) (\w+)', text) if m: @@ -502,7 +502,7 @@ def get_params(self): return params -class IssueLogTimePage(BasePage): +class IssueLogTimePage(Page): def logtime(self, hours, message): self.browser.select_form(predicate=lambda form: form.attrs.get('action', '').endswith('/edit')) self.browser['time_entry[hours]'] = '%.2f' % hours @@ -511,5 +511,5 @@ def logtime(self, hours, message): self.browser.submit() -class IssueTimeEntriesPage(BasePage): +class IssueTimeEntriesPage(Page): pass diff --git a/modules/redmine/pages/wiki.py b/modules/redmine/pages/wiki.py index 27fa4bef91..06f4597695 100644 --- a/modules/redmine/pages/wiki.py +++ b/modules/redmine/pages/wiki.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class WikiEditPage(BasePage): +class WikiEditPage(Page): def get_source(self): return self.parser.select(self.document.getroot(), 'textarea#content_text', 1).text @@ -37,5 +37,5 @@ def get_authenticity_token(self): return wiki_form.xpath('div/input')[0].get('value') -class WikiPage(BasePage): +class WikiPage(Page): pass diff --git a/modules/seeklyrics/pages.py b/modules/seeklyrics/pages.py index 8d5af1b431..8bde8c25cf 100644 --- a/modules/seeklyrics/pages.py +++ b/modules/seeklyrics/pages.py @@ -20,10 +20,10 @@ from weboob.capabilities.lyrics import SongLyrics from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ArtistResultsPage(BasePage): +class ArtistResultsPage(Page): def iter_lyrics(self): for link in self.parser.select(self.document.getroot(), 'table[title~=Results] a.tlink'): artist = unicode(link.text_content()) @@ -33,7 +33,7 @@ def iter_lyrics(self): yield lyr -class ArtistSongsPage(BasePage): +class ArtistSongsPage(Page): def iter_lyrics(self, artist): for th in self.parser.select(self.document.getroot(), 'th.text'): txt = th.text_content() @@ -47,7 +47,7 @@ def iter_lyrics(self, artist): yield songlyrics -class SongResultsPage(BasePage): +class SongResultsPage(Page): def iter_lyrics(self): first = True for tr in self.parser.select(self.document.getroot(), 'table[title~=Results] tr'): @@ -68,7 +68,7 @@ def iter_lyrics(self): yield songlyrics -class SonglyricsPage(BasePage): +class SonglyricsPage(Page): def get_lyrics(self, id): artist = NotAvailable title = NotAvailable diff --git a/modules/seloger/pages.py b/modules/seloger/pages.py index 261413f3ad..c231cd4731 100644 --- a/modules/seloger/pages.py +++ b/modules/seloger/pages.py @@ -21,12 +21,12 @@ from decimal import Decimal from dateutil.parser import parse as parse_date -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.base import NotAvailable from weboob.capabilities.housing import Housing, HousingPhoto -class SearchResultsPage(BasePage): +class SearchResultsPage(Page): def next_page_url(self): urls = self.document.getroot().xpath('//pagesuivante') if len(urls) == 0: @@ -57,7 +57,7 @@ def iter_housings(self): yield housing -class HousingPage(BasePage): +class HousingPage(Page): def get_housing(self, housing=None): if housing is None: housing = Housing(self.groups[0]) diff --git a/modules/sfr/pages/compose.py b/modules/sfr/pages/compose.py index 5c688db740..aadfb8ef4e 100644 --- a/modules/sfr/pages/compose.py +++ b/modules/sfr/pages/compose.py @@ -21,14 +21,14 @@ import re from weboob.capabilities.messages import CantSendMessage -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class ClosePage(BasePage): +class ClosePage(Page): pass -class ComposePage(BasePage): +class ComposePage(Page): phone_regex = re.compile('^(\+33|0033|0)(6|7)(\d{8})$') def get_nb_remaining_free_sms(self): @@ -45,11 +45,11 @@ def post_message(self, message): self.browser.submit() -class ConfirmPage(BasePage): +class ConfirmPage(Page): def confirm(self): self.browser.select_form(nr=0) self.browser.submit() -class SentPage(BasePage): +class SentPage(Page): pass diff --git a/modules/sfr/pages/login.py b/modules/sfr/pages/login.py index 8de7f6b65e..d87ec83096 100644 --- a/modules/sfr/pages/login.py +++ b/modules/sfr/pages/login.py @@ -18,10 +18,10 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class LoginPage(BasePage): +class LoginPage(Page): def login(self, login, password): self.browser.select_form(nr=0) self.browser['username'] = login diff --git a/modules/societegenerale/pages/base.py b/modules/societegenerale/pages/base.py index 2196cd857a..1d17d9a857 100644 --- a/modules/societegenerale/pages/base.py +++ b/modules/societegenerale/pages/base.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage as _BasePage +from weboob.tools.browser import Page as _BasePage class BasePage(_BasePage): diff --git a/modules/societegenerale/sgpe/pages.py b/modules/societegenerale/sgpe/pages.py index f1d23a342e..b7112984da 100644 --- a/modules/societegenerale/sgpe/pages.py +++ b/modules/societegenerale/sgpe/pages.py @@ -23,7 +23,7 @@ from decimal import Decimal from datetime import datetime -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.json import json from weboob.tools.mech import ClientForm from weboob.tools.misc import to_unicode @@ -63,7 +63,7 @@ class Transaction(FrenchTransaction): _coming = False -class SGPEPage(BasePage): +class SGPEPage(Page): def get_error(self): err = self.document.getroot().cssselect('div.ngo_mire_reco_message') \ or self.document.getroot().cssselect('#nge_zone_centre .nge_cadre_message_utilisateur') diff --git a/modules/sueurdemetal/pages.py b/modules/sueurdemetal/pages.py index 9b1c0e8bd6..22e79b164d 100644 --- a/modules/sueurdemetal/pages.py +++ b/modules/sueurdemetal/pages.py @@ -18,13 +18,13 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.date import parse_french_date import re from urlparse import urljoin -class PageWithConcerts(BasePage): +class PageWithConcerts(Page): def extract_concert(self, concert_table): d = {} date_h3 = concert_table.iter('h3').next() @@ -123,7 +123,7 @@ def parse_price(self, s): return float(parts[-1]) -class PageCityList(BasePage): +class PageCityList(Page): def get_cities(self): cities = {} for option in self.document.xpath('//select[@name="ville"]/option'): @@ -139,7 +139,7 @@ def get_cities(self): return cities -class PageDates(BasePage): +class PageDates(Page): def get_dates(self): for a in self.document.xpath('//div[@id="dateconcerts"]//a'): d = {} diff --git a/modules/supertoinette/pages.py b/modules/supertoinette/pages.py index 855de11a27..ee0e501add 100644 --- a/modules/supertoinette/pages.py +++ b/modules/supertoinette/pages.py @@ -20,12 +20,12 @@ from weboob.capabilities.recipe import Recipe from weboob.capabilities.base import NotAvailable, NotLoaded -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import string -class ResultsPage(BasePage): +class ResultsPage(Page): """ Page which contains results as a list of recipies """ def iter_recipes(self): @@ -57,7 +57,7 @@ def iter_recipes(self): yield recipe -class RecipePage(BasePage): +class RecipePage(Page): """ Page which contains a recipe """ def get_recipe(self, id): diff --git a/modules/trictractv/pages.py b/modules/trictractv/pages.py index b53ff89c7b..b99d1aac1f 100644 --- a/modules/trictractv/pages.py +++ b/modules/trictractv/pages.py @@ -21,13 +21,13 @@ import re from weboob.capabilities.image import BaseImage -from weboob.tools.browser import BasePage, BrokenPageError +from weboob.tools.browser import Page, BrokenPageError from .video import TricTracTVVideo -class IndexPage(BasePage): +class IndexPage(Page): def iter_videos(self): for div in self.parser.select(self.document.getroot(), 'li#contentsearch'): title = self.parser.select(div, '#titlesearch span', 1) @@ -53,7 +53,7 @@ def iter_videos(self): yield video -class VideoPage(BasePage): +class VideoPage(Page): def on_loaded(self): p = self.parser.select(self.document.getroot(), 'p.alert') if len(p) > 0: diff --git a/modules/tvsubtitles/pages.py b/modules/tvsubtitles/pages.py index 0ffae76d1d..07e5a7eb86 100644 --- a/modules/tvsubtitles/pages.py +++ b/modules/tvsubtitles/pages.py @@ -20,10 +20,10 @@ import re from weboob.capabilities.subtitle import Subtitle -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class HomePage(BasePage): +class HomePage(Page): def iter_subtitles(self, language, pattern): self.browser.select_form(nr=0) self.browser['q'] = pattern.encode('utf-8') @@ -33,7 +33,7 @@ def iter_subtitles(self, language, pattern): yield subtitle -class SearchPage(BasePage): +class SearchPage(Page): """ Page which contains results as a list of series """ def iter_subtitles(self, language): @@ -50,7 +50,7 @@ def iter_subtitles(self, language): yield subtitle -class SeriePage(BasePage): +class SeriePage(Page): """ Page of all seasons """ def iter_subtitles(self, language, only_one_season=False): @@ -77,7 +77,7 @@ def iter_subtitles(self, language, only_one_season=False): yield subtitle -class SeasonPage(BasePage): +class SeasonPage(Page): """ Page of a season with the right language """ def get_subtitle(self): diff --git a/modules/ups/pages.py b/modules/ups/pages.py index 0dc5bd295a..2c2d3f0364 100644 --- a/modules/ups/pages.py +++ b/modules/ups/pages.py @@ -22,10 +22,10 @@ from dateutil.parser import parse as parse_date from weboob.capabilities.parcel import Parcel, Event -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class TrackPage(BasePage): +class TrackPage(Page): def get_info(self, id): if len(self.parser.tocleanstring(self.document.xpath('//p[@class="error"]')[0])) > 0: return None diff --git a/modules/voyagessncf/pages.py b/modules/voyagessncf/pages.py index e025b94a17..4bbe68afd3 100644 --- a/modules/voyagessncf/pages.py +++ b/modules/voyagessncf/pages.py @@ -22,22 +22,22 @@ from decimal import Decimal from datetime import time, datetime, timedelta -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.json import json from weboob.tools.mech import ClientForm from weboob.capabilities.base import UserError, Currency -class ForeignPage(BasePage): +class ForeignPage(Page): def on_loaded(self): raise UserError('Your IP address is localized in a country not supported by this module (%s). Currently only the French website is supported.' % self.group_dict['country']) -class CitiesPage(BasePage): +class CitiesPage(Page): def get_stations(self): result = json.loads(self.document[self.document.find('{'):-2]) return result['CITIES'] -class SearchPage(BasePage): +class SearchPage(Page): def search(self, departure, arrival, date, age, card, comfort_class): self.browser.select_form(name='saisie') self.browser['ORIGIN_CITY'] = departure.encode(self.browser.ENCODING) @@ -57,19 +57,19 @@ def search(self, departure, arrival, date, age, card, comfort_class): self.browser['nbAnimalsForTravel'] = '0' self.browser.submit() -class SearchErrorPage(BasePage): +class SearchErrorPage(Page): def on_loaded(self): p = self.document.getroot().cssselect('div.messagesError p') if len(p) > 0: message = p[0].text.strip() raise UserError(message) -class SearchInProgressPage(BasePage): +class SearchInProgressPage(Page): def on_loaded(self): link = self.document.xpath('//a[@id="url_redirect_proposals"]')[0] self.browser.location(link.attrib['href']) -class ResultsPage(BasePage): +class ResultsPage(Page): def get_value(self, div, name, last=False): i = -1 if last else 0 p = div.cssselect(name)[i] diff --git a/modules/weather/pages.py b/modules/weather/pages.py index 608f27996e..c9afe1af37 100644 --- a/modules/weather/pages.py +++ b/modules/weather/pages.py @@ -18,13 +18,13 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.capabilities.weather import Forecast, Current, City import datetime -class CityPage(BasePage): +class CityPage(Page): def iter_city_search(self): for item in self.document.findall('//div[@class="searchResultsList"]/ul/li'): if item.attrib.get('class', '') == 'searchResultsMoreLink': @@ -34,7 +34,7 @@ def iter_city_search(self): yield City(city_id, city_name) -class WeatherPage(BasePage): +class WeatherPage(Page): def get_city(self): parts = self.url.split('/')[-1].split('+') return City(parts[-1], u', '.join(parts[:-1])) @@ -46,7 +46,7 @@ def get_current(self): return Current(date, temp, text, u'F') -class ForecastPage(BasePage): +class ForecastPage(Page): def iter_forecast(self): divs = self.document.findall('//div[@class="wx-daypart"]') diff --git a/modules/wellsfargo/pages.py b/modules/wellsfargo/pages.py index a8f0e5ced6..1a889bb08a 100644 --- a/modules/wellsfargo/pages.py +++ b/modules/wellsfargo/pages.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . from weboob.capabilities.bank import Account, Transaction -from weboob.tools.browser2.page import BasePage, HTMLPage, LoggedPage, RawPage +from weboob.tools.browser2.page import Page, HTMLPage, LoggedPage, RawPage from urllib import unquote from .parsers import StatementParser, clean_amount, clean_label import itertools @@ -60,7 +60,7 @@ def to_statements(self): self.browser.location(href) -class DynamicPage(BasePage): +class DynamicPage(Page): """ Most of Wells Fargo pages have the same URI pattern. Some of these pages are HTML, some are PDF. diff --git a/modules/wordreference/pages.py b/modules/wordreference/pages.py index ce7d510a1c..63e789cb89 100644 --- a/modules/wordreference/pages.py +++ b/modules/wordreference/pages.py @@ -18,14 +18,14 @@ # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page import re LAST_THING_IN_PARENTHESIS = re.compile("\([^)]\)$") -class TranslatePage(BasePage): +class TranslatePage(Page): def get_translation(self): trs = self.document.getroot().xpath("//table[@class='WRD']/tr[@class='even']") if trs and len(trs) > 0: diff --git a/modules/youporn/pages/base.py b/modules/youporn/pages/base.py index 7e5135badd..12d05c3925 100644 --- a/modules/youporn/pages/base.py +++ b/modules/youporn/pages/base.py @@ -21,10 +21,10 @@ ControlNotFoundError = ClientForm.ControlNotFoundError from mechanize import FormNotFoundError -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page -class PornPage(BasePage): +class PornPage(Page): def on_loaded(self): try: self.browser.select_form(nr=0) diff --git a/modules/youtube/pages.py b/modules/youtube/pages.py index c6c7feb5ad..285fc81f28 100644 --- a/modules/youtube/pages.py +++ b/modules/youtube/pages.py @@ -32,11 +32,11 @@ import io from weboob.capabilities.base import UserError -from weboob.tools.browser import BasePage, BrokenPageError, BrowserIncorrectPassword +from weboob.tools.browser import Page, BrokenPageError, BrowserIncorrectPassword from weboob.tools.json import json -class LoginPage(BasePage): +class LoginPage(Page): def on_loaded(self): errors = [] for errdiv in self.parser.select(self.document.getroot(), 'div.errormsg'): @@ -52,7 +52,7 @@ def login(self, username, password): self.browser.submit() -class LoginRedirectPage(BasePage): +class LoginRedirectPage(Page): pass @@ -60,7 +60,7 @@ class ForbiddenVideo(UserError): pass -class BaseYoutubePage(BasePage): +class BaseYoutubePage(Page): def is_logged(self): try: self.parser.select(self.document.getroot(), 'span#yt-masthead-account-picker', 1) @@ -179,7 +179,7 @@ class VideoPage(BaseYoutubePage): } def __init__(self, *args, **kwargs): - BasePage.__init__(self, *args, **kwargs) + Page.__init__(self, *args, **kwargs) self._player_cache = {} def _extract_signature_function(self, video_id, player_url, slen): diff --git a/weboob/tools/browser/__init__.py b/weboob/tools/browser/__init__.py index a5edd88839..2d2917cf71 100644 --- a/weboob/tools/browser/__init__.py +++ b/weboob/tools/browser/__init__.py @@ -21,11 +21,11 @@ from weboob.tools.browser.browser import BrowserIncorrectPassword, BrowserBanned, \ BrowserUnavailable, BrowserRetry, \ BrowserHTTPNotFound, BrowserHTTPError, \ - BasePage, BaseBrowser, BrokenPageError, \ + Page, BaseBrowser, BrokenPageError, \ StandardBrowser, BrowserPasswordExpired, \ BrowserForbidden __all__ = ['BrowserIncorrectPassword', 'BrowserPasswordExpired', 'BrowserBanned', 'BrowserUnavailable', 'BrowserRetry', 'BrowserHTTPNotFound', 'BrowserHTTPError', - 'BasePage', 'BaseBrowser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden'] + 'Page', 'BaseBrowser', 'BrokenPageError', 'StandardBrowser', 'BrowserForbidden'] diff --git a/weboob/tools/browser/browser.py b/weboob/tools/browser/browser.py index c84fe54692..7c6a030a02 100644 --- a/weboob/tools/browser/browser.py +++ b/weboob/tools/browser/browser.py @@ -57,7 +57,7 @@ from weboob.tools.parsers import get_parser __all__ = ['BrowserIncorrectPassword', 'BrowserForbidden', 'BrowserBanned', 'BrowserUnavailable', 'BrowserRetry', - 'BrowserPasswordExpired', 'BrowserHTTPNotFound', 'BrowserHTTPError', 'BrokenPageError', 'BasePage', + 'BrowserPasswordExpired', 'BrowserHTTPNotFound', 'BrowserHTTPError', 'BrokenPageError', 'Page', 'StandardBrowser', 'BaseBrowser'] @@ -89,7 +89,7 @@ class BrokenPageError(Exception): pass -class BasePage(object): +class Page(object): """ Base page """ @@ -526,7 +526,7 @@ def is_on_page(self, pageCls): Check the current page. :param pageCls: class of the page to check - :type pageCls: :class:`BasePage` + :type pageCls: :class:`Page` :rtype: bool """ return isinstance(self.page, pageCls) diff --git a/weboob/tools/browser2/__init__.py b/weboob/tools/browser2/__init__.py index 2f736dd277..c231bc6a90 100644 --- a/weboob/tools/browser2/__init__.py +++ b/weboob/tools/browser2/__init__.py @@ -18,8 +18,8 @@ # along with weboob. If not, see . from .browser import BaseBrowser, DomainBrowser, Wget, Firefox, UrlNotAllowed, Profile -from .page import PagesBrowser, BasePage, URL, HTMLPage, LoginBrowser, need_login, JsonPage, LoggedPage, XMLPage +from .page import PagesBrowser, Page, URL, HTMLPage, LoginBrowser, need_login, JsonPage, LoggedPage, XMLPage __all__ = ['BaseBrowser', 'DomainBrowser', 'Wget', 'Firefox', 'UrlNotAllowed', 'Profile', 'XMLPage', - 'PagesBrowser', 'BasePage', 'URL', 'HTMLPage', 'LoginBrowser', 'need_login', 'JsonPage', 'LoggedPage'] + 'PagesBrowser', 'Page', 'URL', 'HTMLPage', 'LoginBrowser', 'need_login', 'JsonPage', 'LoggedPage'] diff --git a/weboob/tools/browser2/page.py b/weboob/tools/browser2/page.py index 61f4509604..2e0cb5fc96 100644 --- a/weboob/tools/browser2/page.py +++ b/weboob/tools/browser2/page.py @@ -49,7 +49,7 @@ class URL(object): """ A description of an URL on the PagesBrowser website. - It takes one or several regexps to match urls, and an optional BasePage + It takes one or several regexps to match urls, and an optional Page class which is instancied by PagesBrowser.open if the page matches a regex. """ _creation_counter = 0 @@ -73,7 +73,7 @@ def is_here(self, **kwargs): If arguments are provided, and only then, they are checked against the arguments that were used to build the current page URL. """ - assert self.klass is not None, "You can use this method only if the is a BasePage class handler." + assert self.klass is not None, "You can use this method only if the is a Page class handler." if len(kwargs): params = self.match(self.build(**kwargs)).groupdict() @@ -237,15 +237,15 @@ class PagesBrowser(DomainBrowser): To use it, you have to derive it and to create URL objects as class attributes. When open() or location() are called, if the url matches - one of URL objects, it returns a BasePage object. In case of location(), it + one of URL objects, it returns a Page object. In case of location(), it stores it in self.page. Example: - >>> class HomePage(BasePage): + >>> class HomePage(Page): ... pass ... - >>> class ListPage(BasePage): + >>> class ListPage(Page): ... pass ... >>> class MyBrowser(PagesBrowser): @@ -405,7 +405,7 @@ def inner(page, *args, **kwargs): class NextPage(Exception): """ - Exception used for example in a BasePage to tell PagesBrowser.pagination to + Exception used for example in a Page to tell PagesBrowser.pagination to go on the next page. See :meth:`PagesBrowser.pagination` or decorator :func:`pagination`. @@ -445,7 +445,7 @@ def do_login(self): raise NotImplementedError() -class BasePage(object): +class Page(object): """ Base page. """ @@ -561,7 +561,7 @@ def submit(self, **kwargs): return self.page.browser.location(self.request, **kwargs) -class CsvPage(BasePage): +class CsvPage(Page): DIALECT = 'excel' FMTPARAMS = {} ENCODING = 'utf-8' @@ -613,14 +613,14 @@ def decode_row(self, row, encoding): return row -class JsonPage(BasePage): +class JsonPage(Page): def __init__(self, browser, response, *args, **kwargs): super(JsonPage, self).__init__(browser, response, *args, **kwargs) from weboob.tools.json import json self.doc = json.loads(response.text) -class XMLPage(BasePage): +class XMLPage(Page): ENCODING = None """ Force a page encoding. @@ -634,13 +634,13 @@ def __init__(self, browser, response, *args, **kwargs): self.doc = etree.parse(BytesIO(response.content), parser) -class RawPage(BasePage): +class RawPage(Page): def __init__(self, browser, response, *args, **kwargs): super(RawPage, self).__init__(browser, response, *args, **kwargs) self.doc = response.content -class HTMLPage(BasePage): +class HTMLPage(Page): """ HTML page. """ diff --git a/weboob/tools/capabilities/gallery/genericcomicreader.py b/weboob/tools/capabilities/gallery/genericcomicreader.py index a0fa855af2..c9763fcab3 100644 --- a/weboob/tools/capabilities/gallery/genericcomicreader.py +++ b/weboob/tools/capabilities/gallery/genericcomicreader.py @@ -23,12 +23,12 @@ from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage from weboob.tools.backend import Module -from weboob.tools.browser import BaseBrowser, BasePage +from weboob.tools.browser import BaseBrowser, Page __all__ = ['GenericComicReaderModule'] -class DisplayPage(BasePage): +class DisplayPage(Page): def get_page(self, gallery): src = self.document.xpath(self.browser.params['img_src_xpath'])[0] diff --git a/weboob/tools/capabilities/messages/genericArticle.py b/weboob/tools/capabilities/messages/genericArticle.py index 9118fdfc0f..019d384bf5 100644 --- a/weboob/tools/capabilities/messages/genericArticle.py +++ b/weboob/tools/capabilities/messages/genericArticle.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.browser import BasePage +from weboob.tools.browser import Page from weboob.tools.browser import BrokenPageError from lxml.etree import Comment @@ -90,7 +90,7 @@ def __init__(self, browser, _id): self.date = None -class GenericNewsPage(BasePage): +class GenericNewsPage(Page): __element_body = NotImplementedError __article = Article element_title_selector = NotImplementedError -- GitLab