Rename BasePage to Page
This commit is contained in:
parent
44dffce7b2
commit
444d36eee8
146 changed files with 525 additions and 525 deletions
|
|
@ -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>`.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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):
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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):
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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')
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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'):
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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([])
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue