Rename BasePage to Page

This commit is contained in:
Florent 2014-09-23 10:50:25 +02:00
commit 444d36eee8
146 changed files with 525 additions and 525 deletions

View file

@ -330,7 +330,7 @@ Then, each method on your browser which need your user to be authenticated may b
return self.page.get_accounts() return self.page.get_accounts()
The last thing to know is that :func:`need_login <weboob.tools.browser2.page.need_login>` checks if the current page is a logged one by The last thing to know is that :func:`need_login <weboob.tools.browser2.page.need_login>` checks if the current page is a logged one by
reading the attribute :func:`logged <weboob.tools.browser2.page.BasePage.logged>` of the instance. You can either define it yourself, as a reading the attribute :func:`logged <weboob.tools.browser2.page.Page.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 <weboob.tools.browser2.page.LoggedPage>`. class boolean attribute or as a property, or to inherit your class from :class:`LoggedPage <weboob.tools.browser2.page.LoggedPage>`.

View file

@ -20,10 +20,10 @@
from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.recipe import Recipe, Comment
from weboob.capabilities.base import NotAvailable, NotLoaded 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 """ Page which contains results as a list of recipies
""" """
def iter_recipes(self): def iter_recipes(self):
@ -62,7 +62,7 @@ class ResultsPage(BasePage):
yield recipe yield recipe
class RecipePage(BasePage): class RecipePage(Page):
""" Page which contains a recipe """ Page which contains a recipe
""" """
def get_recipe(self, id): def get_recipe(self, id):

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.html import html2text from weboob.tools.html import html2text
from .job import AdeccoJobAdvert from .job import AdeccoJobAdvert
import datetime import datetime
@ -27,7 +27,7 @@ import re
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'] 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): 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) re_id = re.compile('http://www.adecco.fr/trouver-un-emploi/Pages/Details-de-l-Offre/(.*?)/(.*?).aspx\?IOF=(.*?)$', re.DOTALL)
@ -55,7 +55,7 @@ class SearchPage(BasePage):
yield advert yield advert
class AdvertPage(BasePage): class AdvertPage(Page):
def get_job_advert(self, url, advert): 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) re_id = re.compile('http://www.adecco.fr/trouver-un-emploi/Pages/Details-de-l-Offre/(.*?)/(.*?).aspx\?IOF=(.*?)$', re.DOTALL)
if advert is None: if advert is None:

View file

@ -20,14 +20,14 @@
from weboob.capabilities.recipe import Recipe from weboob.capabilities.recipe import Recipe
from weboob.capabilities.base import NotAvailable, NotLoaded 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 pass
class ResultsPage(BasePage): class ResultsPage(Page):
""" Page which contains results as a list of recipies """ Page which contains results as a list of recipies
""" """
def iter_recipes(self): def iter_recipes(self):
@ -56,7 +56,7 @@ class ResultsPage(BasePage):
yield recipe yield recipe
class RecipePage(BasePage): class RecipePage(Page):
""" Page which contains a recipe """ Page which contains a recipe
""" """
def get_recipe(self, id): def get_recipe(self, id):

View file

@ -22,14 +22,14 @@ from datetime import datetime
import re import re
import urllib import urllib
from decimal import Decimal 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 from weboob.capabilities.bill import Subscription, Detail, Bill
# Ugly array to avoid the use of french locale # 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'] 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): def is_logged(self):
try: try:
self.parser.select(self.document.getroot(), 'a.logout', 1) self.parser.select(self.document.getroot(), 'a.logout', 1)

View file

@ -22,7 +22,7 @@ from datetime import datetime
from decimal import Decimal from decimal import Decimal
import re import re
import urllib import urllib
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bill import Subscription, Detail, Bill from weboob.capabilities.bill import Subscription, Detail, Bill
@ -30,7 +30,7 @@ from weboob.capabilities.bill import Subscription, Detail, Bill
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'] 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): def login(self, login, password):
self.browser.select_form('connexionCompteForm') self.browser.select_form('connexionCompteForm')
self.browser["vp_connexion_portlet_1numPS"] = login.encode('utf8') self.browser["vp_connexion_portlet_1numPS"] = login.encode('utf8')
@ -38,13 +38,13 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class HomePage(BasePage): class HomePage(Page):
def on_loaded(self): def on_loaded(self):
pass pass
class AccountPage(BasePage): class AccountPage(Page):
def get_subscription_list(self): def get_subscription_list(self):
ident = self.document.xpath('//div[@id="identification"]')[0] ident = self.document.xpath('//div[@id="identification"]')[0]
@ -59,7 +59,7 @@ class AccountPage(BasePage):
return sub return sub
class HistoryPage(BasePage): class HistoryPage(Page):
def iter_history(self): def iter_history(self):
table = self.document.xpath('//table[contains(concat(" ", @class, " "), " cTableauTriable ")]')[0].xpath('.//tr') table = self.document.xpath('//table[contains(concat(" ", @class, " "), " cTableauTriable ")]')[0].xpath('.//tr')
@ -83,7 +83,7 @@ class HistoryPage(BasePage):
yield det yield det
class BillsPage(BasePage): class BillsPage(Page):
def iter_bills(self): def iter_bills(self):
table = self.document.xpath('//table[@id="releveCompteMensuel"]')[0].xpath('.//tr') table = self.document.xpath('//table[@id="releveCompteMensuel"]')[0].xpath('.//tr')

View file

@ -22,14 +22,14 @@ import datetime
from decimal import Decimal from decimal import Decimal
import re 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.bank import Account
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction
from weboob.tools.date import ChaoticDateGuesser from weboob.tools.date import ChaoticDateGuesser
class LoginPage(BasePage): class LoginPage(Page):
def login(self, username, password): def login(self, username, password):
self.browser.select_form(name='ssoform') self.browser.select_form(name='ssoform')
self.browser.set_all_readonly(False) self.browser.set_all_readonly(False)
@ -40,7 +40,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
def get_list(self): def get_list(self):
for box in self.document.getroot().cssselect('div.roundedBox div.contentBox'): for box in self.document.getroot().cssselect('div.roundedBox div.contentBox'):
a = Account() a = Account()
@ -56,7 +56,7 @@ class AccountsPage(BasePage):
yield a yield a
class TransactionsPage(BasePage): class TransactionsPage(Page):
COL_ID = 0 COL_ID = 0
COL_DATE = 1 COL_DATE = 1
COL_DEBIT_DATE = 2 COL_DEBIT_DATE = 2

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.html import html2text from weboob.tools.html import html2text
import dateutil.parser import dateutil.parser
import re import re
@ -26,7 +26,7 @@ import re
from .job import ApecJobAdvert from .job import ApecJobAdvert
class SearchPage(BasePage): class SearchPage(Page):
def iter_job_adverts(self): def iter_job_adverts(self):
re_id_title = re.compile('/offres-emploi-cadres/\d*_\d*_\d*_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?)_(.*?).html', re.DOTALL) 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']") divs = self.document.getroot().xpath("//div[@class='boxContent offre']") + self.document.getroot().xpath("//div[@class='boxContent offre even']")
@ -43,7 +43,7 @@ class SearchPage(BasePage):
yield advert yield advert
class AdvertPage(BasePage): class AdvertPage(Page):
def get_job_advert(self, url, advert): def get_job_advert(self, url, advert):
re_id_title = re.compile('/offres-emploi-cadres/\d*_\d*_\d*_(.*?)________(.*?).html(.*?)', re.DOTALL) re_id_title = re.compile('/offres-emploi-cadres/\d*_\d*_\d*_(.*?)________(.*?).html(.*?)', re.DOTALL)
if advert is None: if advert is None:

View file

@ -21,11 +21,11 @@
from decimal import Decimal from decimal import Decimal
from weboob.capabilities.bank import Account 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 weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, username, password): def login(self, username, password):
self.browser.select_form(nr=0) self.browser.select_form(nr=0)
self.browser['_58_login'] = username.encode('utf-8') self.browser['_58_login'] = username.encode('utf-8')
@ -33,7 +33,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
COL_LABEL = 0 COL_LABEL = 0
COL_OWNER = 1 COL_OWNER = 1
COL_ID = 2 COL_ID = 2
@ -59,7 +59,7 @@ class Transaction(FrenchTransaction):
pass pass
class OperationsPage(BasePage): class OperationsPage(Page):
COL_DATE = 0 COL_DATE = 0
COL_LABEL = 1 COL_LABEL = 1
COL_AMOUNT = 2 COL_AMOUNT = 2

View file

@ -21,14 +21,14 @@ import re
from weboob.capabilities.base import UserError from weboob.capabilities.base import UserError
from weboob.capabilities.image import BaseImage 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 weboob.capabilities import NotAvailable
from .video import ArretSurImagesVideo from .video import ArretSurImagesVideo
class IndexPage(BasePage): class IndexPage(Page):
def iter_videos(self): def iter_videos(self):
videos = self.document.getroot().cssselect("div[class=bloc-contenu-8]") videos = self.document.getroot().cssselect("div[class=bloc-contenu-8]")
for div in videos: for div in videos:
@ -55,7 +55,7 @@ class ForbiddenVideo(UserError):
pass pass
class VideoPage(BasePage): class VideoPage(Page):
def is_logged(self): def is_logged(self):
try: try:
self.parser.select(self.document.getroot(), '#user-info', 1) self.parser.select(self.document.getroot(), '#user-info', 1)
@ -106,7 +106,7 @@ class VideoPage(BasePage):
return url return url
class LoginPage(BasePage): class LoginPage(Page):
def login(self, username, password): def login(self, username, password):
response = self.browser.response() response = self.browser.response()
response.set_data(response.get_data().replace("<br/>", "<br />")) # Python mechanize is broken, fixing it. response.set_data(response.get_data().replace("<br/>", "<br />")) # Python mechanize is broken, fixing it.
@ -119,5 +119,5 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class LoginRedirectPage(BasePage): class LoginRedirectPage(Page):
pass pass

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.html import html2text from weboob.tools.html import html2text
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
@ -26,7 +26,7 @@ from weboob.capabilities.collection import Collection
from .video import ArteLiveVideo from .video import ArteLiveVideo
class ArteLiveVideoPage(BasePage): class ArteLiveVideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
if not video: if not video:
video = ArteLiveVideo(self.group_dict['id']) video = ArteLiveVideo(self.group_dict['id'])
@ -43,7 +43,7 @@ class ArteLiveVideoPage(BasePage):
return json_url, video return json_url, video
class ArteLivePage(BasePage): class ArteLivePage(Page):
def iter_resources(self): def iter_resources(self):
items = list() items = list()
for el in self.document.xpath('//ul[@class="filter-liste"]/li'): for el in self.document.xpath('//ul[@class="filter-liste"]/li'):

View file

@ -20,10 +20,10 @@
from weboob.capabilities.subtitle import Subtitle from weboob.capabilities.subtitle import Subtitle
from weboob.capabilities.base import NotAvailable 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): def iter_subtitles(self, language, pattern):
fontresult = self.parser.select(self.document.getroot(), 'div.search-results font.search-results') 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 # for each result in freefind, explore the subtitle list page to iter subtitles
@ -37,7 +37,7 @@ class SearchPage(BasePage):
yield subtitle yield subtitle
class SubtitlesPage(BasePage): class SubtitlesPage(Page):
def get_subtitle(self, id): def get_subtitle(self, id):
href = id.split('|')[1] href = id.split('|')[1]
# we have to find the 'tr' which contains the link to this address # we have to find the 'tr' which contains the link to this address

View file

@ -22,7 +22,7 @@ import urllib
from decimal import Decimal, InvalidOperation from decimal import Decimal, InvalidOperation
import re 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.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard

View file

@ -24,7 +24,7 @@ from decimal import Decimal
import re import re
from mechanize import Cookie, FormNotFoundError 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.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction

View file

@ -22,12 +22,12 @@ import datetime
from decimal import Decimal from decimal import Decimal
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
self.browser.select_form(name='frmLogin') self.browser.select_form(name='frmLogin')
self.browser['username'] = login.encode(self.browser.ENCODING) self.browser['username'] = login.encode(self.browser.ENCODING)
@ -41,7 +41,7 @@ class LoginPage(BasePage):
return True return True
class Login2Page(BasePage): class Login2Page(Page):
def login(self, secret): def login(self, secret):
label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip() label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip()
letters = '' letters = ''
@ -53,11 +53,11 @@ class Login2Page(BasePage):
self.browser.submit(name='valider', nologin=True) self.browser.submit(name='valider', nologin=True)
class IndexPage(BasePage): class IndexPage(Page):
pass pass
class AccountsPage(BasePage): class AccountsPage(Page):
ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS, ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS,
u'Liquidités': Account.TYPE_CHECKING, u'Liquidités': Account.TYPE_CHECKING,
u'Titres': Account.TYPE_MARKET, u'Titres': Account.TYPE_MARKET,
@ -170,7 +170,7 @@ class Transaction(FrenchTransaction):
] ]
class HistoryBasePage(BasePage): class HistoryBasePage(Page):
def get_history(self): def get_history(self):
self.logger.warning('Do not support account of type %s' % type(self).__name__) self.logger.warning('Do not support account of type %s' % type(self).__name__)
return iter([]) return iter([])

View file

@ -24,7 +24,7 @@ from datetime import datetime
import re import re
from weboob.capabilities.bank import Account 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.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardError from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardError
from weboob.tools.misc import to_unicode from weboob.tools.misc import to_unicode
@ -50,7 +50,7 @@ class Transaction(FrenchTransaction):
] ]
class BEPage(BasePage): class BEPage(Page):
def get_error(self): def get_error(self):
for title in self.document.xpath('/html/head/title'): for title in self.document.xpath('/html/head/title'):
if 'erreur' in title.text or 'error' in title.text: if 'erreur' in title.text or 'error' in title.text:

View file

@ -24,10 +24,10 @@ from decimal import Decimal
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.capabilities.base import NotAvailable 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 = { ACCOUNT_TYPES = {
u'Liquidités': Account.TYPE_CHECKING, u'Liquidités': Account.TYPE_CHECKING,
u'Epargne disponible': Account.TYPE_SAVINGS, u'Epargne disponible': Account.TYPE_SAVINGS,

View file

@ -22,7 +22,7 @@ import time
import re import re
import urllib import urllib
from weboob.tools.browser import BasePage, BrowserUnavailable from weboob.tools.browser import Page, BrowserUnavailable
from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError
@ -72,7 +72,7 @@ class BNPVirtKeyboard(VirtKeyboard):
return code return code
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.getroot().cssselect('td.LibelleErreur'): for td in self.document.getroot().cssselect('td.LibelleErreur'):
if td.text is None: if td.text is None:
@ -101,7 +101,7 @@ class LoginPage(BasePage):
self.browser.location(url, urllib.urlencode(params)) self.browser.location(url, urllib.urlencode(params))
class ConfirmPage(BasePage): class ConfirmPage(Page):
def get_error(self): def get_error(self):
for td in self.document.xpath('//td[@class="hdvon1"]'): for td in self.document.xpath('//td[@class="hdvon1"]'):
if td.text: if td.text:
@ -115,12 +115,12 @@ class ConfirmPage(BasePage):
return m.group(1) return m.group(1)
class InfoMessagePage(BasePage): class InfoMessagePage(Page):
def on_loaded(self): def on_loaded(self):
pass pass
class ChangePasswordPage(BasePage): class ChangePasswordPage(Page):
def change_password(self, current, new): def change_password(self, current, new):
try: try:
vk=BNPVirtKeyboard(self) vk=BNPVirtKeyboard(self)

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage, BrokenPageError from weboob.tools.browser import Page, BrokenPageError
from weboob.capabilities.messages import Message, Thread from weboob.capabilities.messages import Message, Thread
from weboob.capabilities.base import NotLoaded from weboob.capabilities.base import NotLoaded
from weboob.tools.capabilities.messages.genericArticle import try_drop_tree from weboob.tools.capabilities.messages.genericArticle import try_drop_tree
@ -29,7 +29,7 @@ from datetime import datetime
from lxml.html import make_links_absolute from lxml.html import make_links_absolute
class MessagesPage(BasePage): class MessagesPage(Page):
def iter_threads(self): def iter_threads(self):
table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1) table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1)
for tr in table.xpath('./tr'): for tr in table.xpath('./tr'):
@ -61,7 +61,7 @@ class MessagesPage(BasePage):
yield thread yield thread
class MessagePage(BasePage): class MessagePage(Page):
def get_content(self): def get_content(self):
""" """
Get the message content. Get the message content.

View file

@ -20,7 +20,7 @@
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.capabilities.bank.transactions import FrenchTransaction 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): def iter_operations(self):
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'): for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):
if len(tr.xpath('td[@class="debit"]')) == 0: if len(tr.xpath('td[@class="debit"]')) == 0:

View file

@ -20,7 +20,7 @@
import re import re
from weboob.tools.browser import BasePage, BrowserPasswordExpired from weboob.tools.browser import Page, BrowserPasswordExpired
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import TransferError from weboob.capabilities.bank import TransferError
@ -33,7 +33,7 @@ class Account(object):
self.receive_checkbox = receive_checkbox self.receive_checkbox = receive_checkbox
class TransferPage(BasePage): class TransferPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.xpath('//td[@class="hdvon1"]'): for td in self.document.xpath('//td[@class="hdvon1"]'):
if td.text and 'Vous avez atteint le seuil de' in td.text: if td.text and 'Vous avez atteint le seuil de' in td.text:
@ -88,7 +88,7 @@ class TransferPage(BasePage):
self.browser.submit() self.browser.submit()
class TransferConfirmPage(BasePage): class TransferConfirmPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.getroot().cssselect('td#size2'): for td in self.document.getroot().cssselect('td#size2'):
raise TransferError(td.text.strip()) raise TransferError(td.text.strip())
@ -100,6 +100,6 @@ class TransferConfirmPage(BasePage):
return return
class TransferCompletePage(BasePage): class TransferCompletePage(Page):
def get_id(self): def get_id(self):
return self.group_dict['id'] return self.group_dict['id']

View file

@ -24,12 +24,12 @@ from decimal import Decimal, InvalidOperation
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from .perso.transactions import Transaction from .perso.transactions import Transaction
class ProAccountsList(BasePage): class ProAccountsList(Page):
COL_LABEL = 1 COL_LABEL = 1
COL_ID = 2 COL_ID = 2
COL_BALANCE = 3 COL_BALANCE = 3
@ -77,7 +77,7 @@ class ProAccountsList(BasePage):
return accounts return accounts
class ProAccountHistory(BasePage): class ProAccountHistory(Page):
COL_DATE = 0 COL_DATE = 0
COL_LABEL = 1 COL_LABEL = 1
COL_DEBIT = -2 COL_DEBIT = -2

View file

@ -22,7 +22,7 @@
from urlparse import urlparse from urlparse import urlparse
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.capabilities.bank.transactions import FrenchTransaction 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): def get_operations(self):
for form in self.document.xpath('//form[@name="marques"]'): for form in self.document.xpath('//form[@name="marques"]'):
for tr in form.xpath('.//tbody/tr'): for tr in form.xpath('.//tbody/tr'):

View file

@ -22,11 +22,11 @@
from decimal import Decimal from decimal import Decimal
from weboob.capabilities.bank import Account 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 weboob.tools.capabilities.bank.transactions import FrenchTransaction
class AccountsList(BasePage): class AccountsList(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -21,7 +21,7 @@
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.capabilities.bank.transactions import FrenchTransaction 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): def get_operations(self):
for form in self.document.xpath('//form[@name="marques"]'): for form in self.document.xpath('//form[@name="marques"]'):
for tr in form.xpath('.//tbody/tr'): for tr in form.xpath('.//tbody/tr'):

View file

@ -22,7 +22,7 @@ import re
import hashlib import hashlib
import urllib import urllib
from weboob.tools.browser import BasePage, BrowserIncorrectPassword from weboob.tools.browser import Page, BrowserIncorrectPassword
from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard
@ -73,7 +73,7 @@ class VirtKeyboard(MappedVirtKeyboard):
return hashlib.md5(s).hexdigest() return hashlib.md5(s).hexdigest()
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass
# for td in self.document.getroot().cssselect('td.LibelleErreur'): # for td in self.document.getroot().cssselect('td.LibelleErreur'):
@ -97,6 +97,6 @@ class LoginPage(BasePage):
self.browser.location(form.attrib['action'], urllib.urlencode(args), no_login=True) self.browser.location(form.attrib['action'], urllib.urlencode(args), no_login=True)
class UpdateInfoPage(BasePage): class UpdateInfoPage(Page):
def on_loaded(self): def on_loaded(self):
raise BrowserIncorrectPassword('Please update your login credentials') raise BrowserIncorrectPassword('Please update your login credentials')

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage, BrowserIncorrectPassword from weboob.tools.browser import Page, BrowserIncorrectPassword
import urllib2 import urllib2
import re import re
@ -27,7 +27,7 @@ class BrowserAuthenticationCodeMaxLimit(BrowserIncorrectPassword):
pass pass
class AuthenticationPage(BasePage): class AuthenticationPage(Page):
MAX_LIMIT = "vous avez atteint le nombre maximum "\ MAX_LIMIT = "vous avez atteint le nombre maximum "\
"d'utilisation de l'authentification forte." "d'utilisation de l'authentification forte."

View file

@ -21,10 +21,10 @@
import re import re
from weboob.capabilities.messages import CantSendMessage 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})$') phone_regex = re.compile('^(\+33|0033|0)(6|7)(\d{8})$')
def post_message(self, message): def post_message(self, message):
@ -37,14 +37,14 @@ class ComposeFrame(BasePage):
self.browser.submit() self.browser.submit()
class ComposePage(BasePage): class ComposePage(Page):
pass pass
class ConfirmPage(BasePage): class ConfirmPage(Page):
def confirm(self): def confirm(self):
self.browser.location('http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/resultSendSMS.phtml') self.browser.location('http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/resultSendSMS.phtml')
class SentPage(BasePage): class SentPage(Page):
pass pass

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, password): def login(self, login, password):
self.browser.select_form(name='code') self.browser.select_form(name='code')
self.browser['j_username'] = login self.browser['j_username'] = login
@ -29,7 +29,7 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class LoginSASPage(BasePage): class LoginSASPage(Page):
def login(self): def login(self):
self.browser.select_form(name='redirect') self.browser.select_form(name='redirect')
self.browser.submit() self.browser.submit()

View file

@ -22,7 +22,7 @@ import datetime
import re import re
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class Transaction(FrenchTransaction): class Transaction(FrenchTransaction):
@ -46,7 +46,7 @@ class Transaction(FrenchTransaction):
] ]
class AccountHistory(BasePage): class AccountHistory(Page):
def get_next_link(self): def get_next_link(self):
for a in self.document.xpath('//a[@class="btn_crt"]'): for a in self.document.xpath('//a[@class="btn_crt"]'):
txt = u''.join([txt.strip() for txt in a.itertext()]) txt = u''.join([txt.strip() for txt in a.itertext()])
@ -105,7 +105,7 @@ class AccountHistory(BasePage):
return operations return operations
class CardsList(BasePage): class CardsList(Page):
def get_cards(self): def get_cards(self):
cards = [] cards = []
for tr in self.document.xpath('//table[@class="dataNum"]/tbody/tr'): for tr in self.document.xpath('//table[@class="dataNum"]/tbody/tr'):

View file

@ -21,13 +21,13 @@
from decimal import Decimal from decimal import Decimal
from weboob.capabilities.bank import Account, AccountNotFound 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.misc import to_unicode
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
class AccountList(BasePage): class AccountList(Page):
def on_loaded(self): def on_loaded(self):
self.accounts = OrderedDict() self.accounts = OrderedDict()
self.parse_table('comptes', Account.TYPE_CHECKING) self.parse_table('comptes', Account.TYPE_CHECKING)

View file

@ -23,7 +23,7 @@ import hashlib
import re import re
import lxml.etree as etree 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 from weboob.tools.captcha.virtkeyboard import VirtKeyboard
@ -33,7 +33,7 @@ def md5(f):
return md5.hexdigest() return md5.hexdigest()
class UnavailablePage(BasePage): class UnavailablePage(Page):
def on_loaded(self): def on_loaded(self):
raise BrowserUnavailable() raise BrowserUnavailable()
@ -85,7 +85,7 @@ class Keyboard(VirtKeyboard):
# strip borders # strip borders
return VirtKeyboard.get_symbol_coords(self, (x1+3, y1+3, x2-3, y2-3)) 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): def login(self, login, pwd):
vk = Keyboard(self) vk = Keyboard(self)
@ -96,24 +96,24 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class repositionnerCheminCourant(BasePage): class repositionnerCheminCourant(Page):
def on_loaded(self): def on_loaded(self):
self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/initialiser-identif.ea") self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/initialiser-identif.ea")
class Initident(BasePage): class Initident(Page):
def on_loaded(self): def on_loaded(self):
self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/verifierMotDePasse-identif.ea") self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/verifierMotDePasse-identif.ea")
class CheckPassword(BasePage): class CheckPassword(Page):
def on_loaded(self): def on_loaded(self):
self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/comptesCommun/synthese_assurancesEtComptes/init-synthese.ea") self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/comptesCommun/synthese_assurancesEtComptes/init-synthese.ea")
class BadLoginPage(BasePage): class BadLoginPage(Page):
pass pass
class AccountDesactivate(BasePage): class AccountDesactivate(Page):
pass pass

View file

@ -21,11 +21,11 @@
import re import re
from weboob.capabilities.bank import TransferError 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 from weboob.tools.misc import to_unicode
class TransferChooseAccounts(BasePage): class TransferChooseAccounts(Page):
def set_accouts(self, from_account, to_account): def set_accouts(self, from_account, to_account):
self.browser.select_form(name="AiguillageForm") self.browser.select_form(name="AiguillageForm")
self.browser["idxCompteEmetteur"] = [from_account.id] self.browser["idxCompteEmetteur"] = [from_account.id]
@ -33,19 +33,19 @@ class TransferChooseAccounts(BasePage):
self.browser.submit() self.browser.submit()
class CompleteTransfer(BasePage): class CompleteTransfer(Page):
def complete_transfer(self, amount): def complete_transfer(self, amount):
self.browser.select_form(name="virement_unitaire_saisie_saisie_virement_sepa") self.browser.select_form(name="virement_unitaire_saisie_saisie_virement_sepa")
self.browser["montant"] = str(amount) self.browser["montant"] = str(amount)
self.browser.submit() self.browser.submit()
class TransferConfirm(BasePage): class TransferConfirm(Page):
def confirm(self): def confirm(self):
self.browser.location('https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/virement/virementSafran_national/confirmerVirementNational-virementNational.ea') 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): def get_transfer_id(self):
p = self.document.xpath("//div[@id='main']/div/p")[0] p = self.document.xpath("//div[@id='main']/div/p")[0]

View file

@ -25,14 +25,14 @@ ControlNotFoundError = ClientForm.ControlNotFoundError
from decimal import Decimal, InvalidOperation from decimal import Decimal, InvalidOperation
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.misc import to_unicode from weboob.tools.misc import to_unicode
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
try: try:
length = int(self.document.xpath('//input[@id="pass"]')[0].attrib['maxlength']) length = int(self.document.xpath('//input[@id="pass"]')[0].attrib['maxlength'])
@ -52,7 +52,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class LoginResultPage(BasePage): class LoginResultPage(Page):
def on_loaded(self): def on_loaded(self):
for script in self.document.xpath('//script'): for script in self.document.xpath('//script'):
text = script.text text = script.text
@ -113,11 +113,11 @@ class LoginResultPage(BasePage):
return error.text.strip() return error.text.strip()
class EmptyPage(BasePage): class EmptyPage(Page):
pass pass
class BredBasePage(BasePage): class BredBasePage(Page):
def js2args(self, s): def js2args(self, s):
cur_arg = None cur_arg = None
args = {} args = {}
@ -207,7 +207,7 @@ class Transaction(FrenchTransaction):
] ]
class TransactionsPage(BasePage): class TransactionsPage(Page):
def get_history(self, is_coming=None): def get_history(self, is_coming=None):
last_debit = None last_debit = None
transactions = [] transactions = []

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class IndexPage(BasePage): class IndexPage(Page):
pass pass

View file

@ -4,12 +4,12 @@ from datetime import datetime, timedelta
from urlparse import urlparse, parse_qs from urlparse import urlparse, parse_qs
from weboob.tools.misc import get_bytes_size 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.torrent import Torrent, MagnetOnly
from weboob.capabilities.base import NotAvailable from weboob.capabilities.base import NotAvailable
class TorrentsPage(BasePage): class TorrentsPage(Page):
def iter_torrents(self): def iter_torrents(self):
try: try:
@ -50,7 +50,7 @@ class TorrentsPage(BasePage):
torrent.date = date torrent.date = date
yield torrent yield torrent
class TorrentPage(BasePage): class TorrentPage(Page):
def get_torrent(self, id): def get_torrent(self, id):
trs = self.document.getroot().cssselect('table.torrent_info_tbl tr') trs = self.document.getroot().cssselect('table.torrent_info_tbl tr')

View file

@ -22,11 +22,11 @@ import string
from weboob.capabilities.torrent import Torrent from weboob.capabilities.torrent import Torrent
from weboob.capabilities.base import NotAvailable, NotLoaded 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 from weboob.tools.misc import get_bytes_size
class TorrentsPage(BasePage): class TorrentsPage(Page):
def iter_torrents(self): def iter_torrents(self):
for div in self.parser.select(self.document.getroot(),'div.list_tor'): for div in self.parser.select(self.document.getroot(),'div.list_tor'):
name = NotAvailable name = NotAvailable
@ -63,7 +63,7 @@ class TorrentsPage(BasePage):
yield torrent yield torrent
class TorrentPage(BasePage): class TorrentPage(Page):
def get_torrent(self): def get_torrent(self):
seed = 0 seed = 0
leech = 0 leech = 0

View file

@ -26,13 +26,13 @@ import re
from weboob.tools.mech import ClientForm from weboob.tools.mech import ClientForm
from weboob.tools.ordereddict import OrderedDict 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 import NotAvailable
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class _LogoutPage(BasePage): class _LogoutPage(Page):
def on_loaded(self): def on_loaded(self):
try: try:
raise BrowserIncorrectPassword(self.parser.tocleanstring(self.parser.select(self.document.getroot(), '.messErreur', 1))) raise BrowserIncorrectPassword(self.parser.tocleanstring(self.parser.select(self.document.getroot(), '.messErreur', 1)))
@ -83,7 +83,7 @@ class LoginPage(_LogoutPage):
class ErrorPage(_LogoutPage): class ErrorPage(_LogoutPage):
pass pass
class UnavailablePage(BasePage): class UnavailablePage(Page):
def on_loaded(self): def on_loaded(self):
try: try:
raise BrowserUnavailable(self.parser.select(self.document.getroot(), 'div#message_error_hs', 1).text.strip()) 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, ACCOUNT_TYPES = {u'Epargne liquide': Account.TYPE_SAVINGS,
u'Compte Courant': Account.TYPE_CHECKING, u'Compte Courant': Account.TYPE_CHECKING,
u'Mes comptes': Account.TYPE_CHECKING, u'Mes comptes': Account.TYPE_CHECKING,

View file

@ -20,7 +20,7 @@
from datetime import datetime from datetime import datetime
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.collection import Collection from weboob.capabilities.collection import Collection
from weboob.capabilities.base import NotAvailable, NotLoaded from weboob.capabilities.base import NotAvailable, NotLoaded
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
@ -28,7 +28,7 @@ from weboob.capabilities.image import BaseImage
from .video import CanalplusVideo from .video import CanalplusVideo
class ChannelsPage(BasePage): class ChannelsPage(Page):
def get_channels(self): def get_channels(self):
""" """
Extract all possible channels (paths) from the page Extract all possible channels (paths) from the page
@ -55,7 +55,7 @@ class ChannelsPage(BasePage):
return friendly_id, name return friendly_id, name
class VideoPage(BasePage): class VideoPage(Page):
def parse_video(self, el, video=None): def parse_video(self, el, video=None):
_id = el.find('ID').text _id = el.find('ID').text
if _id == '-1': if _id == '-1':

View file

@ -13,7 +13,7 @@ import urllib
import datetime import datetime
from weboob.capabilities.base import NotAvailable from weboob.capabilities.base import NotAvailable
from weboob.tools.misc import to_unicode 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 BrokenPageError
from weboob.tools.browser import BaseBrowser from weboob.tools.browser import BaseBrowser
from weboob.tools.browser.decorators import id2url from weboob.tools.browser.decorators import id2url
@ -37,7 +37,7 @@ class CappedVideo(BaseVideo):
# parser for search pages # parser for search pages
class IndexPage(BasePage): class IndexPage(Page):
def iter_videos(self): def iter_videos(self):
# When no results are found, the website returns random results # When no results are found, the website returns random results
sb = self.parser.select(self.document.getroot(), 'div.search form input.searchbox', 1) sb = self.parser.select(self.document.getroot(), 'div.search form input.searchbox', 1)
@ -85,7 +85,7 @@ class IndexPage(BasePage):
# parser for the video page # parser for the video page
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
_id = to_unicode(self.group_dict['id']) _id = to_unicode(self.group_dict['id'])
if video is None: if video is None:

View file

@ -19,16 +19,16 @@
from datetime import date from datetime import date
from weboob.capabilities.library import Book, Renew 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.mech import ClientForm
from weboob.tools.html import html2text from weboob.tools.html import html2text
class SkipPage(BasePage): class SkipPage(Page):
pass pass
class HomePage(BasePage): class HomePage(Page):
def on_loaded(self): def on_loaded(self):
link = self.document.find('//a[@id="patronRSSFeedLinkComponent"]') link = self.document.find('//a[@id="patronRSSFeedLinkComponent"]')
self.id = link.attrib['href'].split('/')[4] 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])) return date(int(split[2]) + 2000, int(split[1]), int(split[0]))
class RentedPage(BasePage): class RentedPage(Page):
def get_list(self): def get_list(self):
for tr in self.document.getroot().xpath('//tr[@class="patFuncEntry"]'): for tr in self.document.getroot().xpath('//tr[@class="patFuncEntry"]'):
id = tr.xpath('td/input')[0].attrib["value"] id = tr.xpath('td/input')[0].attrib["value"]
@ -77,16 +77,16 @@ class RentedPage(BasePage):
return renew return renew
class HistoryPage(BasePage): class HistoryPage(Page):
pass pass
class BookedPage(BasePage): class BookedPage(Page):
# TODO: book some books... # TODO: book some books...
pass pass
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
self.browser.select_form(nr=0) self.browser.select_form(nr=0)
self.browser.form.set_all_readonly(False) self.browser.form.set_all_readonly(False)

View file

@ -23,16 +23,16 @@ from dateutil.parser import parse as parse_date
from weboob.capabilities.parcel import Parcel, Event from weboob.capabilities.parcel import Parcel, Event
from weboob.capabilities import NotAvailable 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): def track_package(self, _id):
self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'suivreEnvoi') self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'suivreEnvoi')
self.browser['chronoNumbers'] = _id.encode('utf-8') self.browser['chronoNumbers'] = _id.encode('utf-8')
self.browser.submit() self.browser.submit()
class TrackPage(BasePage): class TrackPage(Page):
def get_info(self, id): def get_info(self, id):
if len(self.document.xpath('//libelle[@nom="MSG_AUCUN_EVT"]')) > 0: if len(self.document.xpath('//libelle[@nom="MSG_AUCUN_EVT"]')) > 0:
return None return None

View file

@ -24,14 +24,14 @@ from decimal import Decimal
import re import re
from dateutil.relativedelta import relativedelta 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.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.date import parse_french_date from weboob.tools.date import parse_french_date
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
self.browser.select_form(name='ident') self.browser.select_form(name='ident')
self.browser['_cm_user'] = login.encode(self.browser.ENCODING) self.browser['_cm_user'] = login.encode(self.browser.ENCODING)
@ -39,35 +39,35 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class LoginErrorPage(BasePage): class LoginErrorPage(Page):
pass pass
class ChangePasswordPage(BasePage): class ChangePasswordPage(Page):
def on_loaded(self): def on_loaded(self):
raise BrowserIncorrectPassword('Please change your password') raise BrowserIncorrectPassword('Please change your password')
class VerifCodePage(BasePage): class VerifCodePage(Page):
def on_loaded(self): def on_loaded(self):
raise BrowserIncorrectPassword('Unable to login: website asks a code from a card') raise BrowserIncorrectPassword('Unable to login: website asks a code from a card')
class InfoPage(BasePage): class InfoPage(Page):
pass pass
class EmptyPage(BasePage): class EmptyPage(Page):
pass pass
class TransfertPage(BasePage): class TransfertPage(Page):
pass pass
class UserSpacePage(BasePage): class UserSpacePage(Page):
pass pass
class AccountsPage(BasePage): class AccountsPage(Page):
TYPES = {'C/C': Account.TYPE_CHECKING, TYPES = {'C/C': Account.TYPE_CHECKING,
'Livret': Account.TYPE_SAVINGS, 'Livret': Account.TYPE_SAVINGS,
'Pret': Account.TYPE_LOAN, 'Pret': Account.TYPE_LOAN,
@ -165,7 +165,7 @@ class Transaction(FrenchTransaction):
_is_coming = False _is_coming = False
class OperationsPage(BasePage): class OperationsPage(Page):
def get_history(self): def get_history(self):
index = 0 index = 0
for tr in self.document.getiterator('tr'): for tr in self.document.getiterator('tr'):

View file

@ -22,7 +22,7 @@ from decimal import Decimal
import datetime import datetime
import re import re
from weboob.tools.browser import BasePage, BrowserIncorrectPassword from weboob.tools.browser import Page, BrowserIncorrectPassword
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
@ -36,7 +36,7 @@ class Transaction(FrenchTransaction):
return FrenchTransaction.clean_amount(text) return FrenchTransaction.clean_amount(text)
class LoginPage(BasePage): class LoginPage(Page):
def login(self, merchant_id, login, password): def login(self, merchant_id, login, password):
self.browser.select_form(name='loginForm') self.browser.select_form(name='loginForm')
self.browser['merchant'] = merchant_id.encode(self.browser.ENCODING) self.browser['merchant'] = merchant_id.encode(self.browser.ENCODING)
@ -45,7 +45,7 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class SummaryPage(BasePage): class SummaryPage(Page):
def clean_amount(self, el, debit): def clean_amount(self, el, debit):
amount = Decimal(Transaction.clean_amount(el.text_content())) amount = Decimal(Transaction.clean_amount(el.text_content()))
if amount == Decimal('0.00'): if amount == Decimal('0.00'):
@ -66,13 +66,13 @@ class SummaryPage(BasePage):
return amount return amount
class UselessPage(BasePage): class UselessPage(Page):
def on_loaded(self): def on_loaded(self):
for error in self.document.xpath('//li[@class="error"]'): for error in self.document.xpath('//li[@class="error"]'):
raise BrowserIncorrectPassword(self.parser.tocleanstring(error)) raise BrowserIncorrectPassword(self.parser.tocleanstring(error))
class TransactionSearchPage(BasePage): class TransactionSearchPage(Page):
def search(self, accepted=True, refused=False): def search(self, accepted=True, refused=False):
self.browser.select_form(name='transactionSearchForm') self.browser.select_form(name='transactionSearchForm')
self.browser['selectedDateCriteria'] = ['thisweek'] # TODO ask for more self.browser['selectedDateCriteria'] = ['thisweek'] # TODO ask for more
@ -86,14 +86,14 @@ class TransactionSearchPage(BasePage):
self.browser.submit() self.browser.submit()
class TransactionsPage(BasePage): class TransactionsPage(Page):
def get_csv_url(self): def get_csv_url(self):
for a in self.parser.select(self.document.getroot(), '.exportlinks a'): for a in self.parser.select(self.document.getroot(), '.exportlinks a'):
if len(self.parser.select(a, 'span.csv')): if len(self.parser.select(a, 'span.csv')):
return a.attrib['href'] return a.attrib['href']
class TransactionsCsvPage(BasePage): class TransactionsCsvPage(Page):
def guess_format(self, amount): def guess_format(self, amount):
if re.search(r'\d\.\d\d$', amount): if re.search(r'\d\.\d\d$', amount):
date_format = "%m/%d/%Y" date_format = "%m/%d/%Y"

View file

@ -22,12 +22,12 @@ import datetime
from decimal import Decimal from decimal import Decimal
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
self.browser.select_form(name='formIdentification') self.browser.select_form(name='formIdentification')
self.browser['noPersonne'] = login.encode(self.browser.ENCODING) self.browser['noPersonne'] = login.encode(self.browser.ENCODING)
@ -35,7 +35,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
def get_list(self): def get_list(self):
names = set() names = set()
for li in self.document.xpath('//div[@class="affichMontant"]/ul/li/a'): 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'] 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): def get_next_link(self):

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from datetime import date from datetime import date
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.parcel import Parcel, Event from weboob.capabilities.parcel import Parcel, Event
@ -26,7 +26,7 @@ def update_status(p, status):
if p.status < status: if p.status < status:
p.status = status p.status = status
class TrackPage(BasePage): class TrackPage(Page):
def get_info(self, _id): def get_info(self, _id):
p = Parcel(_id) p = Parcel(_id)
@ -70,5 +70,5 @@ class TrackPage(BasePage):
pass pass
return p return p
class ErrorPage(BasePage): class ErrorPage(Page):
pass pass

View file

@ -18,11 +18,11 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.browser import BrowserUnavailable from weboob.tools.browser import BrowserUnavailable
class CragrBasePage(BasePage): class CragrBasePage(Page):
def on_loaded(self): def on_loaded(self):
# Check for an error # Check for an error
for div in self.document.getiterator('div'): for div in self.document.getiterator('div'):

View file

@ -22,11 +22,11 @@ from decimal import Decimal
from weboob.tools.date import parse_french_date from weboob.tools.date import parse_french_date
from weboob.capabilities.bank import Account 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 from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction
class HomePage(BasePage): class HomePage(Page):
def get_post_url(self): def get_post_url(self):
for script in self.document.xpath('//script'): for script in self.document.xpath('//script'):
text = script.text text = script.text
@ -39,7 +39,7 @@ class HomePage(BasePage):
return None return None
class LoginPage(BasePage): class LoginPage(Page):
def login(self, password): def login(self, password):
assert password.isdigit() assert password.isdigit()
assert len(password) == 6 assert len(password) == 6
@ -60,13 +60,13 @@ class LoginPage(BasePage):
def get_result_url(self): def get_result_url(self):
return self.parser.tocleanstring(self.document.getroot()) return self.parser.tocleanstring(self.document.getroot())
class UselessPage(BasePage): class UselessPage(Page):
pass pass
class LoginErrorPage(BasePage): class LoginErrorPage(Page):
pass pass
class _AccountsPage(BasePage): class _AccountsPage(Page):
COL_LABEL = 0 COL_LABEL = 0
COL_ID = 2 COL_ID = 2
COL_VALUE = 4 COL_VALUE = 4
@ -121,7 +121,7 @@ class _AccountsPage(BasePage):
return links return links
class CardsPage(BasePage): class CardsPage(Page):
def get_list(self): def get_list(self):
TABLE_XPATH = '//table[caption[@class="caption tdb-cartes-caption" or @class="ca-table caption"]]' TABLE_XPATH = '//table[caption[@class="caption tdb-cartes-caption" or @class="ca-table caption"]]'
@ -229,7 +229,7 @@ class AccountsPage(_AccountsPage):
class SavingsPage(_AccountsPage): class SavingsPage(_AccountsPage):
COL_ID = 1 COL_ID = 1
class TransactionsPage(BasePage): class TransactionsPage(Page):
def get_next_url(self): def get_next_url(self):
links = self.document.xpath('//span[@class="pager"]/a[@class="liennavigationcorpspage"]') links = self.document.xpath('//span[@class="pager"]/a[@class="liennavigationcorpspage"]')
if len(links) < 1: if len(links) < 1:

View file

@ -22,12 +22,12 @@ from decimal import Decimal
import re import re
from weboob.tools.json import json 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.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, password): def login(self, login, password):
self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'AuthForm') self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'AuthForm')
self.browser['j_username'] = login.encode('iso-8859-15') self.browser['j_username'] = login.encode('iso-8859-15')
@ -35,7 +35,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class LoggedPage(BasePage): class LoggedPage(Page):
def get_error(self): def get_error(self):
div = self.document.xpath('//div[@class="errorForm-msg"]') div = self.document.xpath('//div[@class="errorForm-msg"]')
if len(div) == 0: if len(div) == 0:
@ -45,7 +45,7 @@ class LoggedPage(BasePage):
return re.sub('[\r\n\t\xa0]+', ' ', msg) return re.sub('[\r\n\t\xa0]+', ' ', msg)
class AccountsPage(BasePage): class AccountsPage(Page):
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
def get_list(self): def get_list(self):
@ -89,11 +89,11 @@ class Transaction(FrenchTransaction):
] ]
class TransactionsPage(BasePage): class TransactionsPage(Page):
pass pass
class TransactionsJSONPage(BasePage): class TransactionsJSONPage(Page):
ROW_DATE = 0 ROW_DATE = 0
ROW_TEXT = 2 ROW_TEXT = 2
ROW_CREDIT = -1 ROW_CREDIT = -1
@ -109,7 +109,7 @@ class TransactionsJSONPage(BasePage):
yield t yield t
class ComingTransactionsPage(BasePage): class ComingTransactionsPage(Page):
ROW_REF = 0 ROW_REF = 0
ROW_TEXT = 1 ROW_TEXT = 1
ROW_DATE = 2 ROW_DATE = 2

View file

@ -22,12 +22,12 @@ from decimal import Decimal
import re import re
import time import time
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, pin, strong_auth): def login(self, login, pin, strong_auth):
form_nb = 1 if strong_auth else 0 form_nb = 1 if strong_auth else 0
indentType = "RENFORCE" if strong_auth else "MDP" indentType = "RENFORCE" if strong_auth else "MDP"
@ -40,7 +40,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
CPT_ROW_ID = 0 CPT_ROW_ID = 0
@ -95,7 +95,7 @@ class Transaction(FrenchTransaction):
FrenchTransaction.TYPE_UNKNOWN), FrenchTransaction.TYPE_UNKNOWN),
] ]
class ITransactionsPage(BasePage): class ITransactionsPage(Page):
def get_next_url(self): def get_next_url(self):
# can be 'Suivant' or ' Suivant' # can be 'Suivant' or ' Suivant'
next = self.document.xpath("//a[normalize-space(text()) = 'Suivant']") next = self.document.xpath("//a[normalize-space(text()) = 'Suivant']")

View file

@ -23,18 +23,18 @@ from decimal import Decimal
import re import re
from cStringIO import StringIO 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.tools.json import json
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
pass pass
class CDNBasePage(BasePage): class CDNBasePage(Page):
def get_from_js(self, pattern, end, is_list=False): def get_from_js(self, pattern, end, is_list=False):
""" """
find a pattern in any javascript text find a pattern in any javascript text

View file

@ -20,10 +20,10 @@
from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.recipe import Recipe, Comment
from weboob.capabilities.base import NotAvailable, NotLoaded 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 """ Page which contains results as a list of recipies
""" """
def iter_recipes(self): def iter_recipes(self):
@ -71,7 +71,7 @@ class ResultsPage(BasePage):
yield recipe yield recipe
class RecipePage(BasePage): class RecipePage(Page):
""" Page which contains a recipe """ Page which contains a recipe
""" """
def get_recipe(self, id): def get_recipe(self, id):

View file

@ -27,13 +27,13 @@ import mechanize
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
from weboob.tools.html import html2text from weboob.tools.html import html2text
from weboob.tools.browser import BasePage, BrokenPageError from weboob.tools.browser import Page, BrokenPageError
from .video import DailymotionVideo from .video import DailymotionVideo
class IndexPage(BasePage): class IndexPage(Page):
def iter_videos(self): def iter_videos(self):
for div in self.parser.select(self.document.getroot(), 'div.sd_video_listitem'): for div in self.parser.select(self.document.getroot(), 'div.sd_video_listitem'):
smalldiv = self.parser.select(div, 'div.sd_video_previewtwig', 1) smalldiv = self.parser.select(div, 'div.sd_video_previewtwig', 1)
@ -82,7 +82,7 @@ class IndexPage(BasePage):
return 0 return 0
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
if video is None: if video is None:
video = DailymotionVideo(self.group_dict['id']) video = DailymotionVideo(self.group_dict['id'])

View file

@ -22,11 +22,11 @@ from decimal import Decimal
import re import re
from weboob.capabilities.bank import Account 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 weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, username, password): def login(self, username, password):
self.browser.select_form(name="frmLogin") self.browser.select_form(name="frmLogin")
self.browser['username'] = username.encode('utf-8') self.browser['username'] = username.encode('utf-8')
@ -36,7 +36,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class DashboardPage(BasePage): class DashboardPage(Page):
def iter_accounts(self): def iter_accounts(self):
for line in self._accounts(): for line in self._accounts():
yield self._get_account(line) yield self._get_account(line)
@ -67,7 +67,7 @@ class DashboardPage(BasePage):
return account return account
class OperationsPage(BasePage): class OperationsPage(Page):
_LINE_XPATH = '//tr[starts-with(@class,"PL_LIGLST_")]' _LINE_XPATH = '//tr[starts-with(@class,"PL_LIGLST_")]'
_NEXT_XPATH = '//a[contains(@class,"pg_next")]/@href' _NEXT_XPATH = '//a[contains(@class,"pg_next")]/@href'

View file

@ -21,7 +21,7 @@
import re import re
from logging import warning from logging import warning
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class Message(object): class Message(object):
@ -43,7 +43,7 @@ class Message(object):
warning('Unable to parse timestamp "%s"' % timestamp) warning('Unable to parse timestamp "%s"' % timestamp)
class BoardIndexPage(BasePage): class BoardIndexPage(Page):
def is_logged(self): def is_logged(self):
return True return True

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class DLFPPage(BasePage): class DLFPPage(Page):
def is_logged(self): def is_logged(self):
for form in self.document.getiterator('form'): for form in self.document.getiterator('form'):
if form.attrib.get('id', None) == 'new_account_sidebar': if form.attrib.get('id', None) == 'new_account_sidebar':

View file

@ -22,12 +22,12 @@ from datetime import datetime
import re import re
import urllib import urllib
from decimal import Decimal from decimal import Decimal
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bill import Subscription, Detail, Bill from weboob.capabilities.bill import Subscription, Detail, Bill
base_url = "http://particuliers.edf.com/" base_url = "http://particuliers.edf.com/"
class EdfBasePage(BasePage): class EdfBasePage(Page):
def is_logged(self): def is_logged(self):
return (u'Me déconnecter' in self.document.xpath('//a/text()')) \ return (u'Me déconnecter' in self.document.xpath('//a/text()')) \
or (self.document.xpath('//table[contains(@summary, "Informations sur mon")]')) or (self.document.xpath('//table[contains(@summary, "Informations sur mon")]'))

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.html import html2text from weboob.tools.html import html2text
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
@ -28,7 +28,7 @@ import re
from .gallery import EHentaiGallery from .gallery import EHentaiGallery
class LoginPage(BasePage): class LoginPage(Page):
def is_logged(self): def is_logged(self):
success_p = self.document.xpath( success_p = self.document.xpath(
'//p[text() = "Login Successful. You will be returned momentarily."]') '//p[text() = "Login Successful. You will be returned momentarily."]')
@ -38,11 +38,11 @@ class LoginPage(BasePage):
return False return False
class HomePage(BasePage): class HomePage(Page):
pass pass
class IndexPage(BasePage): class IndexPage(Page):
def iter_galleries(self): def iter_galleries(self):
lines = self.document.xpath('//table[@class="itg"]//tr[@class="gtr0" or @class="gtr1"]') lines = self.document.xpath('//table[@class="itg"]//tr[@class="gtr0" or @class="gtr1"]')
for line in lines: for line in lines:
@ -52,7 +52,7 @@ class IndexPage(BasePage):
yield EHentaiGallery(re.search('(?<=/g/)\d+/[\dabcdef]+', url).group(0), title=title) yield EHentaiGallery(re.search('(?<=/g/)\d+/[\dabcdef]+', url).group(0), title=title)
class GalleryPage(BasePage): class GalleryPage(Page):
def image_pages(self): def image_pages(self):
return self.document.xpath('//div[@class="gdtm"]//a/attribute::href') return self.document.xpath('//div[@class="gdtm"]//a/attribute::href')
@ -97,6 +97,6 @@ class GalleryPage(BasePage):
gallery.thumbnail.url = gallery.thumbnail.id gallery.thumbnail.url = gallery.thumbnail.id
class ImagePage(BasePage): class ImagePage(Page):
def get_url(self): def get_url(self):
return self.document.xpath('//div[@class="sni"]/a/img/attribute::src')[0] return self.document.xpath('//div[@class="sni"]/a/img/attribute::src')[0]

View file

@ -21,7 +21,7 @@
from weboob.tools.mech import ClientForm from weboob.tools.mech import ClientForm
ControlNotFoundError = ClientForm.ControlNotFoundError ControlNotFoundError = ClientForm.ControlNotFoundError
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
import re import re
import datetime import datetime
@ -32,7 +32,7 @@ from weboob.tools.browser import BrokenPageError
from .video import EuroparlVideo from .video import EuroparlVideo
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
if video is None: if video is None:
video = EuroparlVideo(self.group_dict['id']) video = EuroparlVideo(self.group_dict['id'])

View file

@ -24,7 +24,7 @@ import re
from time import sleep from time import sleep
from weboob.capabilities.bank import Account 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.capabilities import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.json import json from weboob.tools.json import json
@ -50,7 +50,7 @@ class Transaction(FrenchTransaction):
] ]
class AccountHistoryPage(BasePage): class AccountHistoryPage(Page):
def get_operations(self, _id): def get_operations(self, _id):
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction""" """history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
@ -83,7 +83,7 @@ class AccountHistoryPage(BasePage):
yield operation yield operation
class AccountsList(BasePage): class AccountsList(Page):
def on_loaded(self): def on_loaded(self):
warn = self.document.xpath('//div[@id="message_renouvellement_mot_passe"]') warn = self.document.xpath('//div[@id="message_renouvellement_mot_passe"]')
if len(warn) > 0: if len(warn) > 0:
@ -157,7 +157,7 @@ class AccountsList(BasePage):
yield account yield account
class GlobalAccountsList(BasePage): class GlobalAccountsList(Page):
pass pass
# vim:ts=4:sw=4 # vim:ts=4:sw=4

View file

@ -20,10 +20,10 @@
#from logging import error #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): def login(self, login, passwd):
msgb = self.document.xpath(".//*[@id='message_client']/text()") msgb = self.document.xpath(".//*[@id='message_client']/text()")
msga = ''.join(msgb) msga = ''.join(msgb)

View file

@ -22,7 +22,7 @@ import re
from datetime import datetime from datetime import datetime
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class Message(object): class Message(object):
@ -47,7 +47,7 @@ class Message(object):
return '<Message id=%s filename=%s url=%s comments=%d>' % (self.id, self.filename, self.url, len(self.comments)) return '<Message id=%s filename=%s url=%s comments=%d>' % (self.id, self.filename, self.url, len(self.comments))
class BoardPage(BasePage): class BoardPage(Page):
URL_REGEXP = re.compile('http://boards.4chan.org/(\w+)/') URL_REGEXP = re.compile('http://boards.4chan.org/(\w+)/')
def on_loaded(self): def on_loaded(self):

View file

@ -21,12 +21,12 @@
from decimal import Decimal from decimal import Decimal
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, passwd): def login(self, login, passwd):
self.browser.select_form(name='loginForm') self.browser.select_form(name='loginForm')
self.browser.set_all_readonly(False) self.browser.set_all_readonly(False)
@ -35,7 +35,7 @@ class LoginPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
ACCOUNT_TYPES = {u'Solde des comptes bancaires - Groupama Banque': Account.TYPE_CHECKING, ACCOUNT_TYPES = {u'Solde des comptes bancaires - Groupama Banque': Account.TYPE_CHECKING,
u'Epargne bancaire constituée - Groupama Banque': Account.TYPE_SAVINGS, 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): def get_history(self):
count = 0 count = 0
for tr in self.document.xpath('//table[@id="releve_operation"]/tr'): for tr in self.document.xpath('//table[@id="releve_operation"]/tr'):

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BrowserUnavailable, BasePage as _BasePage from weboob.tools.browser import BrowserUnavailable, Page as _BasePage
class BasePage(_BasePage): class BasePage(_BasePage):

View file

@ -19,7 +19,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
import urllib import urllib
import re import re
@ -40,7 +40,7 @@ from .video import GDCVaultVideo
# TODO: check title on 1439 # TODO: check title on 1439
class IndexPage(BasePage): class IndexPage(Page):
def iter_videos(self): def iter_videos(self):
for a in self.parser.select(self.document.getroot(), 'section.conference ul.media_items li.featured a.session_item'): for a in self.parser.select(self.document.getroot(), 'section.conference ul.media_items li.featured a.session_item'):
href = a.attrib.get('href', '') href = a.attrib.get('href', '')
@ -79,7 +79,7 @@ class IndexPage(BasePage):
# the search page class uses a JSON parser, # the search page class uses a JSON parser,
# since it's what search.php returns when POSTed (from Ajax) # since it's what search.php returns when POSTed (from Ajax)
class SearchPage(BasePage): class SearchPage(Page):
def iter_videos(self): def iter_videos(self):
if self.document is None or self.document['data'] is None: if self.document is None or self.document['data'] is None:
raise BrokenPageError('Unable to find JSON data') raise BrokenPageError('Unable to find JSON data')
@ -90,7 +90,7 @@ class SearchPage(BasePage):
continue continue
yield video yield video
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
# check for slides id variant # check for slides id variant
want_slides = False want_slides = False

View file

@ -26,12 +26,12 @@ import shutil
from datetime import date from datetime import date
from decimal import Decimal 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.base import NotAvailable
from weboob.capabilities.bill import Detail, Bill from weboob.capabilities.bill import Detail, Bill
class HistoryPage(BasePage): class HistoryPage(Page):
def on_loaded(self): def on_loaded(self):
self.details = [] self.details = []

View file

@ -19,11 +19,11 @@
from datetime import date from datetime import date
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bill import Subscription from weboob.capabilities.bill import Subscription
class LoginPage(BasePage): class LoginPage(Page):
def login(self, login, password): def login(self, login, password):
self.browser.select_form('symConnexionForm') self.browser.select_form('symConnexionForm')
@ -32,13 +32,13 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class HomePage(BasePage): class HomePage(Page):
def on_loaded(self): def on_loaded(self):
pass pass
class AccountPage(BasePage): class AccountPage(Page):
def get_subscription_list(self): def get_subscription_list(self):
table = self.document.xpath('//table[@id="ensemble_contrat_N0"]')[0] table = self.document.xpath('//table[@id="ensemble_contrat_N0"]')[0]
@ -63,7 +63,7 @@ class AccountPage(BasePage):
yield sub yield sub
class TimeoutPage(BasePage): class TimeoutPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class TranslatePage(BasePage): class TranslatePage(Page):
def get_translation(self): def get_translation(self):
boxes = self.parser.select(self.document.getroot(), 'span#result_box', 1).findall('span') boxes = self.parser.select(self.document.getroot(), 'span#result_box', 1).findall('span')
if len(boxes) == 0: if len(boxes) == 0:

View file

@ -21,14 +21,14 @@
import datetime import datetime
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class ValidationPage(BasePage): class ValidationPage(Page):
pass pass
class HomePage(BasePage): class HomePage(Page):
pass pass
@ -55,7 +55,7 @@ class Story(object):
self.body = None self.body = None
class HistoryPage(BasePage): class HistoryPage(Page):
def get_numerous(self): def get_numerous(self):
td = self.parser.select(self.document.getroot(), 'td.t0', 1) td = self.parser.select(self.document.getroot(), 'td.t0', 1)
n = td.xpath('//u/strong|//u/b')[0].text n = td.xpath('//u/strong|//u/b')[0].text
@ -91,7 +91,7 @@ class HistoryPage(BasePage):
story = None story = None
class StoryPage(BasePage): class StoryPage(Page):
def get_story(self): def get_story(self):
p_tags = self.document.getroot().xpath('//body/p') p_tags = self.document.getroot().xpath('//body/p')
if len(p_tags) > 0 and p_tags[0].text.strip() == \ if len(p_tags) > 0 and p_tags[0].text.strip() == \
@ -146,7 +146,7 @@ class StoryPage(BasePage):
return story return story
class AuthorPage(BasePage): class AuthorPage(Page):
def get_author(self): def get_author(self):
p_tags = self.document.getroot().xpath('//body/div/font/b') p_tags = self.document.getroot().xpath('//body/div/font/b')
if len(p_tags) > 0 and p_tags[0].text.strip() == \ if len(p_tags) > 0 and p_tags[0].text.strip() == \

View file

@ -22,11 +22,11 @@
from decimal import Decimal from decimal import Decimal
from weboob.capabilities.bank import Account 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 from weboob.tools.json import json
class AccountsList(BasePage): class AccountsList(Page):
ACCOUNT_TYPES = { ACCOUNT_TYPES = {
1: Account.TYPE_CHECKING, 1: Account.TYPE_CHECKING,
2: Account.TYPE_SAVINGS, 2: Account.TYPE_SAVINGS,

View file

@ -22,7 +22,7 @@
import time import time
import re import re
from weboob.tools.browser import BasePage, BrowserUnavailable from weboob.tools.browser import Page, BrowserUnavailable
from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError from weboob.tools.captcha.virtkeyboard import VirtKeyboard, VirtKeyboardError
@ -70,7 +70,7 @@ class HelloBankVirtKeyboard(VirtKeyboard):
return code return code
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.getroot().cssselect('td.LibelleErreur'): for td in self.document.getroot().cssselect('td.LibelleErreur'):
if td.text is None: if td.text is None:
@ -93,7 +93,7 @@ class LoginPage(BasePage):
self.browser.submit() self.browser.submit()
class ConfirmPage(BasePage): class ConfirmPage(Page):
def get_error(self): def get_error(self):
for td in self.document.xpath('//td[@class="hdvon1"]'): for td in self.document.xpath('//td[@class="hdvon1"]'):
if td.text: if td.text:
@ -107,6 +107,6 @@ class ConfirmPage(BasePage):
return m.group(1) return m.group(1)
class InfoMessagePage(BasePage): class InfoMessagePage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -18,7 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage, BrokenPageError from weboob.tools.browser import Page, BrokenPageError
from weboob.capabilities.messages import Message, Thread from weboob.capabilities.messages import Message, Thread
from weboob.capabilities.base import NotLoaded from weboob.capabilities.base import NotLoaded
from weboob.tools.capabilities.messages.genericArticle import try_drop_tree from weboob.tools.capabilities.messages.genericArticle import try_drop_tree
@ -29,7 +29,7 @@ from datetime import datetime
from lxml.html import make_links_absolute from lxml.html import make_links_absolute
class MessagesPage(BasePage): class MessagesPage(Page):
def iter_threads(self): def iter_threads(self):
table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1) table = self.parser.select(self.document.getroot(), 'table#listeMessages', 1)
for tr in table.xpath('./tr'): for tr in table.xpath('./tr'):
@ -61,7 +61,7 @@ class MessagesPage(BasePage):
yield thread yield thread
class MessagePage(BasePage): class MessagePage(Page):
def get_content(self): def get_content(self):
""" """
Get the message content. Get the message content.

View file

@ -21,7 +21,7 @@
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.capabilities.bank.transactions import FrenchTransaction 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): def iter_operations(self):
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'): for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):
if len(tr.xpath('td[@class="debit"]')) == 0: if len(tr.xpath('td[@class="debit"]')) == 0:

View file

@ -21,7 +21,7 @@
import re import re
from weboob.tools.browser import BasePage, BrowserPasswordExpired from weboob.tools.browser import Page, BrowserPasswordExpired
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import TransferError from weboob.capabilities.bank import TransferError
@ -34,7 +34,7 @@ class Account(object):
self.receive_checkbox = receive_checkbox self.receive_checkbox = receive_checkbox
class TransferPage(BasePage): class TransferPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.xpath('//td[@class="hdvon1"]'): for td in self.document.xpath('//td[@class="hdvon1"]'):
if td.text and 'Vous avez atteint le seuil de' in td.text: if td.text and 'Vous avez atteint le seuil de' in td.text:
@ -91,7 +91,7 @@ class TransferPage(BasePage):
self.browser.submit() self.browser.submit()
class TransferConfirmPage(BasePage): class TransferConfirmPage(Page):
def on_loaded(self): def on_loaded(self):
for td in self.document.getroot().cssselect('td#size2'): for td in self.document.getroot().cssselect('td#size2'):
raise TransferError(td.text.strip()) raise TransferError(td.text.strip())
@ -103,6 +103,6 @@ class TransferConfirmPage(BasePage):
return return
class TransferCompletePage(BasePage): class TransferCompletePage(Page):
def get_id(self): def get_id(self):
return self.group_dict['id'] return self.group_dict['id']

View file

@ -20,13 +20,13 @@
from weboob.capabilities.cinema import Person, Movie from weboob.capabilities.cinema import Person, Movie
from weboob.capabilities.base import NotAvailable, NotLoaded 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 weboob.tools.html import html2text
from datetime import datetime from datetime import datetime
import re import re
class ReleasePage(BasePage): class ReleasePage(Page):
''' Page containing releases of a movie ''' Page containing releases of a movie
''' '''
def get_movie_releases(self, country_filter): def get_movie_releases(self, country_filter):
@ -54,7 +54,7 @@ class ReleasePage(BasePage):
return result return result
class BiographyPage(BasePage): class BiographyPage(Page):
''' Page containing biography of a person ''' Page containing biography of a person
''' '''
def get_biography(self): def get_biography(self):
@ -71,7 +71,7 @@ class BiographyPage(BasePage):
return bio return bio
class MovieCrewPage(BasePage): class MovieCrewPage(Page):
''' Page listing all the persons related to a movie ''' Page listing all the persons related to a movie
''' '''
def iter_persons(self, role_filter=None): def iter_persons(self, role_filter=None):
@ -126,7 +126,7 @@ class MovieCrewPage(BasePage):
yield id yield id
class PersonPage(BasePage): class PersonPage(Page):
''' Page informing about a person ''' Page informing about a person
It is used to build a Person instance and to get the movie list related to a person It is used to build a Person instance and to get the movie list related to a person
''' '''

View file

@ -21,13 +21,13 @@
import datetime import datetime
import re import re
from weboob.tools.browser import BasePage, BrokenPageError from weboob.tools.browser import Page, BrokenPageError
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
from ..video import InaVideo from ..video import InaVideo
class SearchPage(BasePage): class SearchPage(Page):
URL_REGEXP = re.compile(r'/(.+)/(.+)\.jpeg') URL_REGEXP = re.compile(r'/(.+)/(.+)\.jpeg')
def iter_videos(self): def iter_videos(self):

View file

@ -23,12 +23,12 @@ import re
from weboob.capabilities import NotAvailable from weboob.capabilities import NotAvailable
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from ..video import InaVideo from ..video import InaVideo
class VideoPage(BasePage): class VideoPage(Page):
URL_REGEXP = re.compile('http://player.ina.fr/notices/(.+)\.mrss') URL_REGEXP = re.compile('http://player.ina.fr/notices/(.+)\.mrss')
def get_id(self): def get_id(self):

View file

@ -24,12 +24,12 @@ import re
from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage from weboob.capabilities.gallery import CapGallery, BaseGallery, BaseImage
from weboob.tools.json import json from weboob.tools.json import json
from weboob.tools.backend import Module from weboob.tools.backend import Module
from weboob.tools.browser import BaseBrowser, BasePage from weboob.tools.browser import BaseBrowser, Page
__all__ = ['IzneoModule'] __all__ = ['IzneoModule']
class ReaderV2(BasePage): class ReaderV2(Page):
def get_ean(self): def get_ean(self):
return self.document.xpath("//div[@id='viewer']/attribute::rel")[0] return self.document.xpath("//div[@id='viewer']/attribute::rel")[0]

View file

@ -22,13 +22,13 @@ import re
from weboob.capabilities.base import NotAvailable from weboob.capabilities.base import NotAvailable
from weboob.capabilities.image import BaseImage 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 weboob.tools.misc import to_unicode
from .video import JacquieEtMichelVideo from .video import JacquieEtMichelVideo
class ResultsPage(BasePage): class ResultsPage(Page):
def iter_videos(self): def iter_videos(self):
for span in self.document.xpath('//ul[@id="list"]/li'): for span in self.document.xpath('//ul[@id="list"]/li'):
a = self.parser.select(span, 'a', 1) a = self.parser.select(span, 'a', 1)
@ -49,7 +49,7 @@ class ResultsPage(BasePage):
yield video yield video
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video=None): def get_video(self, video=None):
_id = to_unicode(self.group_dict['id']) _id = to_unicode(self.group_dict['id'])
if video is None: if video is None:

View file

@ -6,14 +6,14 @@ import datetime
from weboob.capabilities.travel import RoadmapError from weboob.capabilities.travel import RoadmapError
from weboob.tools.misc import to_unicode from weboob.tools.misc import to_unicode
from weboob.tools.mech import ClientForm from weboob.tools.mech import ClientForm
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class RoadmapAmbiguity(RoadmapError): class RoadmapAmbiguity(RoadmapError):
def __init__(self, error): def __init__(self, error):
RoadmapError.__init__(self, error) RoadmapError.__init__(self, error)
class RoadmapSearchPage(BasePage): class RoadmapSearchPage(Page):
def search(self, departure, arrival, departure_time, arrival_time): def search(self, departure, arrival, departure_time, arrival_time):
match = -1 match = -1
i = 0 i = 0
@ -46,7 +46,7 @@ class RoadmapSearchPage(BasePage):
raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time)) raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time))
self.browser.submit() self.browser.submit()
class RoadmapResultsPage(BasePage): class RoadmapResultsPage(Page):
def html_br_strip(self, text): def html_br_strip(self, text):
return "".join([l.strip() for l in text.split("\n")]).strip().replace(' ', '%20') return "".join([l.strip() for l in text.split("\n")]).strip().replace(' ', '%20')
@ -96,7 +96,7 @@ class RoadmapResultsPage(BasePage):
self.browser[propname] = [ propvalue ] self.browser[propname] = [ propvalue ]
self.browser.submit() self.browser.submit()
class RoadmapPage(BasePage): class RoadmapPage(Page):
def get_steps(self): def get_steps(self):
errors = [] errors = []
# for p in self.parser.select(self.document.getroot(), 'p.errors'): # for p in self.parser.select(self.document.getroot(), 'p.errors'):

View file

@ -22,11 +22,11 @@ from urlparse import parse_qs, urlsplit
from weboob.capabilities.torrent import Torrent from weboob.capabilities.torrent import Torrent
from weboob.capabilities.base import NotAvailable, NotLoaded 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 from weboob.tools.misc import get_bytes_size
class TorrentsPage(BasePage): class TorrentsPage(Page):
def iter_torrents(self): def iter_torrents(self):
for tr in self.document.getiterator('tr'): for tr in self.document.getiterator('tr'):
if tr.attrib.get('class', '') == 'odd' or tr.attrib.get('class', '') == ' even': if tr.attrib.get('class', '') == 'odd' or tr.attrib.get('class', '') == ' even':
@ -70,7 +70,7 @@ class TorrentsPage(BasePage):
yield torrent yield torrent
class TorrentPage(BasePage): class TorrentPage(Page):
def get_torrent(self, id): def get_torrent(self, id):
seed = 0 seed = 0
leech = 0 leech = 0

View file

@ -21,13 +21,13 @@
from decimal import Decimal from decimal import Decimal
import re import re
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities import NotAvailable, NotLoaded from weboob.capabilities import NotAvailable, NotLoaded
from weboob.capabilities.pricecomparison import Product, Price, Shop from weboob.capabilities.pricecomparison import Product, Price, Shop
# I manage main page, ie do nothing yet # I manage main page, ie do nothing yet
class MainPage(BasePage): class MainPage(Page):
def iter_products(self, criteria): def iter_products(self, criteria):
product = Product(1) product = Product(1)
# TODO check if criteria exists in main page # 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 # I manage listing page and extract information
class ListingAutoPage(BasePage): class ListingAutoPage(Page):
def _extract(self, tr, name): def _extract(self, tr, name):
'Extract content from td element with class name' 'Extract content from td element with class name'
@ -107,7 +107,7 @@ class ListingAutoPage(BasePage):
# I manage one car page (annonce) )and extract information # I manage one car page (annonce) )and extract information
class AnnoncePage(BasePage): class AnnoncePage(Page):
def _extract(self, e, name): def _extract(self, e, name):
'Extract content from li element with class name' 'Extract content from li element with class name'

View file

@ -20,37 +20,37 @@
from decimal import Decimal from decimal import Decimal
from weboob.capabilities.bank import Account 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 weboob.tools.capabilities.bank.transactions import FrenchTransaction
from ..pages import Transaction from ..pages import Transaction
class RootPage(BasePage): class RootPage(Page):
pass pass
class LogoutPage(BasePage): class LogoutPage(Page):
pass pass
class LogoutOkPage(BasePage): class LogoutOkPage(Page):
pass pass
class MessagesPage(BasePage): class MessagesPage(Page):
pass pass
class AlreadyConnectedPage(BasePage): class AlreadyConnectedPage(Page):
pass pass
class ExpiredPage(BasePage): class ExpiredPage(Page):
pass pass
class MovementsPage(BasePage): class MovementsPage(Page):
def get_account(self): def get_account(self):
LABEL_XPATH = '//*[@id="perimetreMandatEnfantLib"]' LABEL_XPATH = '//*[@id="perimetreMandatEnfantLib"]'
BALANCE_XPATH = '//div[contains(text(),"Solde comptable :")]/strong' BALANCE_XPATH = '//div[contains(text(),"Solde comptable :")]/strong'
@ -86,7 +86,7 @@ class MovementsPage(BasePage):
yield operation yield operation
class HomePage(BasePage): class HomePage(Page):
def login(self, login, passwd): def login(self, login, passwd):
p = lambda f: f.attrs.get('id') == "form_autoComplete" p = lambda f: f.attrs.get('id') == "form_autoComplete"
self.browser.select_form(predicate=p) self.browser.select_form(predicate=p)

View file

@ -26,7 +26,7 @@ import random
from weboob.capabilities.bank import Account 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.captcha.virtkeyboard import MappedVirtKeyboard, VirtKeyboardError
from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction
@ -67,11 +67,11 @@ class LCLVirtKeyboard(MappedVirtKeyboard):
return code return code
class SkipPage(BasePage): class SkipPage(Page):
pass pass
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
try: try:
self.browser.select_form(name='form') self.browser.select_form(name='form')
@ -132,7 +132,7 @@ class LoginPage(BasePage):
errors = self.document.xpath(u'//div[@class="erreur" or @class="messError"]') errors = self.document.xpath(u'//div[@class="erreur" or @class="messError"]')
return len(errors) > 0 return len(errors) > 0
class ContractsPage(BasePage): class ContractsPage(Page):
def on_loaded(self): def on_loaded(self):
self.select_contract() self.select_contract()
@ -143,7 +143,7 @@ class ContractsPage(BasePage):
self.browser.submit(nologin=True) self.browser.submit(nologin=True)
class AccountsPage(BasePage): class AccountsPage(Page):
def on_loaded(self): def on_loaded(self):
warn = self.document.xpath('//div[@id="attTxt"]') warn = self.document.xpath('//div[@id="attTxt"]')
if len(warn) > 0: if len(warn) > 0:
@ -234,7 +234,7 @@ class Transaction(FrenchTransaction):
] ]
class AccountHistoryPage(BasePage): class AccountHistoryPage(Page):
def get_table(self): def get_table(self):
tables=self.document.findall("//table[@class='tagTab pyjama']") tables=self.document.findall("//table[@class='tagTab pyjama']")
for table in tables: for table in tables:

View file

@ -26,7 +26,7 @@ import shutil
from datetime import datetime, date, time from datetime import datetime, date, time
from decimal import Decimal from decimal import Decimal
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bill import Detail, Bill from weboob.capabilities.bill import Detail, Bill
@ -156,7 +156,7 @@ class PdfPage():
return sorted(details, key=_get_date, reverse=True) return sorted(details, key=_get_date, reverse=True)
class HistoryPage(BasePage): class HistoryPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.bill import Subscription 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): def on_loaded(self):
pass pass

View file

@ -18,11 +18,11 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
import StringIO import StringIO
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.mech import ClientForm from weboob.tools.mech import ClientForm
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -20,10 +20,10 @@
from .pages.article import ArticlePage, ActuPage from .pages.article import ArticlePage, ActuPage
from .pages.flashactu import FlashActuPage 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 pass

View file

@ -18,14 +18,14 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
import dateutil.parser import dateutil.parser
import re import re
from .job import LolixJobAdvert from .job import LolixJobAdvert
class AdvertPage(BasePage): class AdvertPage(Page):
def get_job_advert(self, url, advert): def get_job_advert(self, url, advert):
tables = self.document.getroot().xpath('//td[@class="Contenu"]/table') tables = self.document.getroot().xpath('//td[@class="Contenu"]/table')
rows = self.parser.select(tables[2], 'tr') rows = self.parser.select(tables[2], 'tr')
@ -66,7 +66,7 @@ class AdvertPage(BasePage):
return advert return advert
class SearchPage(BasePage): class SearchPage(Page):
def iter_job_adverts(self, pattern): def iter_job_adverts(self, pattern):
rows = self.document.getroot().xpath('//td[@class="Contenu"]/table/tr') rows = self.document.getroot().xpath('//td[@class="Contenu"]/table/tr')
for row in rows: for row in rows:

View file

@ -18,11 +18,11 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
import re import re
class PageAll(BasePage): class PageAll(Page):
def post(self, name, content, max_days): def post(self, name, content, max_days):
pass pass

View file

@ -20,10 +20,10 @@
from weboob.capabilities.recipe import Recipe, Comment from weboob.capabilities.recipe import Recipe, Comment
from weboob.capabilities.base import NotAvailable, NotLoaded 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 """ Page which contains results as a list of recipies
""" """
def iter_recipes(self): def iter_recipes(self):
@ -54,7 +54,7 @@ class ResultsPage(BasePage):
yield recipe yield recipe
class RecipePage(BasePage): class RecipePage(Page):
""" Page which contains a recipe """ Page which contains a recipe
""" """
def get_recipe(self, id): def get_recipe(self, id):

View file

@ -19,14 +19,14 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.weather import Forecast, Current, City from weboob.capabilities.weather import Forecast, Current, City
import datetime import datetime
import re import re
class SearchCitiesPage(BasePage): class SearchCitiesPage(Page):
def iter_cities(self): def iter_cities(self):
list = self.document.getroot().xpath('//ul[@class="list-style-1"]/li/a') list = self.document.getroot().xpath('//ul[@class="list-style-1"]/li/a')
for a in list: for a in list:
@ -36,7 +36,7 @@ class SearchCitiesPage(BasePage):
yield mcity yield mcity
class WeatherPage(BasePage): class WeatherPage(Page):
def get_temp_without_unit(self, temp_str): def get_temp_without_unit(self, temp_str):
# It seems that the mechanize module give us some old style # It seems that the mechanize module give us some old style
# ISO character # ISO character

View file

@ -18,14 +18,14 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.tools.html import html2text from weboob.tools.html import html2text
import re import re
from datetime import datetime, time, timedelta from datetime import datetime, time, timedelta
from .job import MonsterJobAdvert from .job import MonsterJobAdvert
class SearchPage(BasePage): class SearchPage(Page):
def iter_job_adverts(self): def iter_job_adverts(self):
re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL) re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL)
trs = self.document.getroot().xpath("//table[@class='listingsTable']/tbody/tr") trs = self.document.getroot().xpath("//table[@class='listingsTable']/tbody/tr")
@ -58,7 +58,7 @@ class SearchPage(BasePage):
yield advert yield advert
class AdvertPage(BasePage): class AdvertPage(Page):
def get_job_advert(self, url, advert): def get_job_advert(self, url, advert):
re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL) re_id = re.compile('http://offre-emploi.monster.fr/(.*?).aspx', re.DOTALL)
if advert is None: if advert is None:

View file

@ -17,13 +17,13 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.radio import Radio from weboob.capabilities.radio import Radio
from weboob.capabilities.audiostream import BaseAudioStream from weboob.capabilities.audiostream import BaseAudioStream
from weboob.tools.capabilities.streaminfo import StreamInfo from weboob.tools.capabilities.streaminfo import StreamInfo
class StreamsPage(BasePage): class StreamsPage(Page):
def iter_radios_list(self): def iter_radios_list(self):
radio = Radio('necta') radio = Radio('necta')
radio.title = u'Nectarine' radio.title = u'Nectarine'
@ -48,7 +48,7 @@ class StreamsPage(BasePage):
yield radio yield radio
class LivePage(BasePage): class LivePage(Page):
def get_current_emission(self): def get_current_emission(self):
current = StreamInfo(0) current = StreamInfo(0)
current.who = unicode(self.document.xpath('//playlist/now/entry/artist')[0].text) current.who = unicode(self.document.xpath('//playlist/now/entry/artist')[0].text)

View file

@ -21,11 +21,11 @@
from datetime import datetime, date, time from datetime import datetime, date, time
from decimal import Decimal from decimal import Decimal
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.bill import Detail from weboob.capabilities.bill import Detail
class DetailsPage(BasePage): class DetailsPage(Page):
def on_loaded(self): def on_loaded(self):
self.details = [] self.details = []
@ -54,12 +54,12 @@ def _get_date(detail):
return detail.datetime return detail.datetime
class BillsPage(BasePage): class BillsPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass
class HistoryPage(BasePage): class HistoryPage(Page):
def on_loaded(self): def on_loaded(self):
self.calls = [] self.calls = []

View file

@ -19,12 +19,12 @@
from weboob.capabilities.bill import Subscription from weboob.capabilities.bill import Subscription
from weboob.tools.capabilities.bank.transactions import FrenchTransaction 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 datetime import date
from decimal import Decimal from decimal import Decimal
class HomePage(BasePage): class HomePage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
class LoginPage(BasePage): class LoginPage(Page):
def on_loaded(self): def on_loaded(self):
pass pass

View file

@ -17,13 +17,13 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
from weboob.capabilities.radio import Radio from weboob.capabilities.radio import Radio
from weboob.capabilities.audiostream import BaseAudioStream from weboob.capabilities.audiostream import BaseAudioStream
from weboob.tools.capabilities.streaminfo import StreamInfo from weboob.tools.capabilities.streaminfo import StreamInfo
class LivePage(BasePage): class LivePage(Page):
def iter_radios_list(self): def iter_radios_list(self):
radio = Radio('nihon') radio = Radio('nihon')
radio.title = u'Nihon no Oto' radio.title = u'Nihon no Oto'
@ -49,7 +49,7 @@ class LivePage(BasePage):
yield radio yield radio
class ProgramPage(BasePage): class ProgramPage(Page):
def get_current_emission(self): def get_current_emission(self):
current = StreamInfo(0) current = StreamInfo(0)
two_or_more = unicode(self.document.xpath('//p')[0].text).split('/////')[0].split(' - ') two_or_more = unicode(self.document.xpath('//p')[0].text).split('/////')[0].split(' - ')

View file

@ -21,7 +21,7 @@
from weboob.capabilities.collection import Collection from weboob.capabilities.collection import Collection
from weboob.capabilities.image import BaseImage from weboob.capabilities.image import BaseImage
from weboob.tools.browser import BasePage from weboob.tools.browser import Page
import re import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
@ -29,7 +29,7 @@ from datetime import datetime, timedelta
from .video import NolifeTVVideo from .video import NolifeTVVideo
class VideoPage(BasePage): class VideoPage(Page):
def get_video(self, video): def get_video(self, video):
if not video: if not video:
video = NolifeTVVideo(self.group_dict['id']) video = NolifeTVVideo(self.group_dict['id'])
@ -67,7 +67,7 @@ class VideoPage(BasePage):
seconds=int(m.group(3))) seconds=int(m.group(3)))
return video return video
class VideoListPage(BasePage): class VideoListPage(Page):
def is_list_empty(self): def is_list_empty(self):
return self.document.getroot() == None return self.document.getroot() == None
@ -85,7 +85,7 @@ class VideoListPage(BasePage):
video.title = video.title + ' - ' + strongs[3].text video.title = video.title + ' - ' + strongs[3].text
yield video yield video
class FamilyPage(BasePage): class FamilyPage(Page):
def iter_category(self): def iter_category(self):
subs = list() subs = list()
@ -109,7 +109,7 @@ class FamilyPage(BasePage):
if m and m.group(1): if m and m.group(1):
yield Collection([m.group(1)], unicode(h1.text)) yield Collection([m.group(1)], unicode(h1.text))
class AboPage(BasePage): class AboPage(Page):
def get_available_videos(self): def get_available_videos(self):
available = ['[Gratuit]'] available = ['[Gratuit]']
@ -123,13 +123,13 @@ class AboPage(BasePage):
return available return available
class LoginPage(BasePage): class LoginPage(Page):
def login(self, username, password): def login(self, username, password):
self.browser.select_form(name='login') self.browser.select_form(name='login')
self.browser['username'] = str(username) self.browser['username'] = str(username)
self.browser['password'] = str(password) self.browser['password'] = str(password)
self.browser.submit() self.browser.submit()
class HomePage(BasePage): class HomePage(Page):
def is_logged(self): def is_logged(self):
return len(self.document.xpath('//a[@href="deconnexion/"]')) == 1 return len(self.document.xpath('//a[@href="deconnexion/"]')) == 1

View file

@ -19,7 +19,7 @@
import urllib import urllib
from weboob.tools.browser import BaseBrowser, BasePage from weboob.tools.browser import BaseBrowser, Page
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
from .pages import LoginPage, ThreadPage, MessagesPage, PostMessagePage, ProfilePage, PhotosPage, VisitsPage, QuickMatchPage, SentPage from .pages import LoginPage, ThreadPage, MessagesPage, PostMessagePage, ProfilePage, PhotosPage, VisitsPage, QuickMatchPage, SentPage
@ -45,7 +45,7 @@ class OkCBrowser(BaseBrowser):
ENCODING = 'UTF-8' ENCODING = 'UTF-8'
PAGES = OrderedDict(( PAGES = OrderedDict((
('https://%s/login.*' % DOMAIN, LoginPage), ('https://%s/login.*' % DOMAIN, LoginPage),
('http://%s/home' % DOMAIN, BasePage), ('http://%s/home' % DOMAIN, Page),
('http://%s/messages' % DOMAIN, ThreadPage), ('http://%s/messages' % DOMAIN, ThreadPage),
('http://%s/messages\?compose=1' % DOMAIN, PostMessagePage), ('http://%s/messages\?compose=1' % DOMAIN, PostMessagePage),
('http://\w+.okcupid.com/messages\?.*', MessagesPage), ('http://\w+.okcupid.com/messages\?.*', MessagesPage),

Some files were not shown because too many files have changed in this diff Show more