Easy spacing fixes, trailing stuff
Remove useless trailing \ Remove trailing spaces Add missing empty lines autopep8 -ir -j2 --select=E301,E302,E502,W291,W293,W391 . Diff quickly checked.
This commit is contained in:
parent
c21d1f7925
commit
7094931c92
231 changed files with 474 additions and 67 deletions
|
|
@ -33,6 +33,7 @@ IRC_NICKNAME = 'boobot'
|
||||||
IRC_SERVER = 'irc.freenode.org'
|
IRC_SERVER = 'irc.freenode.org'
|
||||||
STORAGE_FILE = 'boobot.storage'
|
STORAGE_FILE = 'boobot.storage'
|
||||||
|
|
||||||
|
|
||||||
class MyThread(Thread):
|
class MyThread(Thread):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
|
|
@ -50,9 +51,9 @@ class MyThread(Thread):
|
||||||
self.weboob.loop()
|
self.weboob.loop()
|
||||||
|
|
||||||
def find_keywords(self, text):
|
def find_keywords(self, text):
|
||||||
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg', \
|
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg',
|
||||||
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob', \
|
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob',
|
||||||
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs', \
|
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs',
|
||||||
'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']:
|
'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']:
|
||||||
if word in text.lower():
|
if word in text.lower():
|
||||||
return word
|
return word
|
||||||
|
|
@ -80,6 +81,7 @@ class MyThread(Thread):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.weboob.want_stop()
|
self.weboob.want_stop()
|
||||||
|
|
||||||
|
|
||||||
class TestBot(SingleServerIRCBot):
|
class TestBot(SingleServerIRCBot):
|
||||||
def __init__(self, channel, nickname, server, port=6667):
|
def __init__(self, channel, nickname, server, port=6667):
|
||||||
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`")
|
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`")
|
||||||
|
|
@ -121,6 +123,7 @@ class TestBot(SingleServerIRCBot):
|
||||||
if h:
|
if h:
|
||||||
self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency))
|
self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER)
|
bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER)
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,18 @@ if sys.stdout.encoding is None:
|
||||||
|
|
||||||
# end of hack
|
# end of hack
|
||||||
|
|
||||||
|
|
||||||
def removeNonAscii(s): return "".join(i for i in s if ord(i)<128)
|
def removeNonAscii(s): return "".join(i for i in s if ord(i)<128)
|
||||||
|
|
||||||
rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE)
|
rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE)
|
||||||
|
|
||||||
|
|
||||||
def removeSpecial(s):
|
def removeSpecial(s):
|
||||||
return rx.sub(u' ', u'%s' % s)
|
return rx.sub(u' ', u'%s' % s)
|
||||||
|
|
||||||
DOWNLOAD_DIRECTORY=".files"
|
DOWNLOAD_DIRECTORY=".files"
|
||||||
|
|
||||||
|
|
||||||
class Downloadboob:
|
class Downloadboob:
|
||||||
|
|
||||||
def __init__(self, backend_name, download_directory, links_directory):
|
def __init__(self, backend_name, download_directory, links_directory):
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class VideoobWeb(BaseApplication):
|
||||||
page_url=video.page_url,
|
page_url=video.page_url,
|
||||||
url=video.url if video.url else '/download?id=%s' % video.id,
|
url=video.url if video.url else '/download?id=%s' % video.id,
|
||||||
thumbnail_url=video.thumbnail.url,
|
thumbnail_url=video.thumbnail.url,
|
||||||
) \
|
)
|
||||||
for video in backend.search_videos(pattern=q, nsfw=nsfw)]
|
for video in backend.search_videos(pattern=q, nsfw=nsfw)]
|
||||||
if videos:
|
if videos:
|
||||||
if merge:
|
if merge:
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from __future__ import with_statement
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def genapi():
|
def genapi():
|
||||||
os.system('rm -rf api')
|
os.system('rm -rf api')
|
||||||
os.system('mkdir api')
|
os.system('mkdir api')
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ class IndexPage(BasePage):
|
||||||
|
|
||||||
yield video
|
yield video
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
def get_video(self, video=None, lang='fr', quality='hd'):
|
def get_video(self, video=None, lang='fr', quality='hd'):
|
||||||
if not video:
|
if not video:
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from weboob.tools.test import BackendTest
|
||||||
import urllib
|
import urllib
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
class AttilasubTest(BackendTest):
|
class AttilasubTest(BackendTest):
|
||||||
BACKEND = 'attilasub'
|
BACKEND = 'attilasub'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ def parse_dt(s):
|
||||||
d = _parse_dt(s)
|
d = _parse_dt(s)
|
||||||
return local2utc(d)
|
return local2utc(d)
|
||||||
|
|
||||||
|
|
||||||
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount):
|
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount):
|
||||||
NAME = 'aum'
|
NAME = 'aum'
|
||||||
MAINTAINER = u'Romain Bignon'
|
MAINTAINER = u'Romain Bignon'
|
||||||
|
|
@ -503,6 +504,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
browser = None
|
browser = None
|
||||||
|
|
||||||
REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'')
|
REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'')
|
||||||
|
|
||||||
def confirm_account(self, mail):
|
def confirm_account(self, mail):
|
||||||
msg = email.message_from_string(mail)
|
msg = email.message_from_string(mail)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class AuMException(UserError):
|
||||||
Exception.__init__(self, self.ERRORS.get(code, code))
|
Exception.__init__(self, self.ERRORS.get(code, code))
|
||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
|
||||||
class AuMBrowser(BaseBrowser):
|
class AuMBrowser(BaseBrowser):
|
||||||
DOMAIN = 'www.adopteunmec.com'
|
DOMAIN = 'www.adopteunmec.com'
|
||||||
APIKEY = 'fb0123456789abcd'
|
APIKEY = 'fb0123456789abcd'
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError('Please install python-imaging')
|
raise ImportError('Please install python-imaging')
|
||||||
|
|
||||||
|
|
||||||
class CaptchaError(Exception): pass
|
class CaptchaError(Exception): pass
|
||||||
|
|
||||||
|
|
||||||
class Tile(object):
|
class Tile(object):
|
||||||
hash = {
|
hash = {
|
||||||
'bc8d52d96058478a6def26226145d53b': 'A',
|
'bc8d52d96058478a6def26226145d53b': 'A',
|
||||||
|
|
@ -115,6 +117,7 @@ class Tile(object):
|
||||||
print 'hash: %s' % checksum
|
print 'hash: %s' % checksum
|
||||||
raise CaptchaError()
|
raise CaptchaError()
|
||||||
|
|
||||||
|
|
||||||
class Captcha(object):
|
class Captcha(object):
|
||||||
def __init__(self, f):
|
def __init__(self, f):
|
||||||
self.img = Image.open(f)
|
self.img = Image.open(f)
|
||||||
|
|
@ -156,6 +159,7 @@ class Captcha(object):
|
||||||
s += tile.letter
|
s += tile.letter
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
class Decoder(object):
|
class Decoder(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.hash = {}
|
self.hash = {}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ class FieldConst(FieldBase):
|
||||||
labels.append(consts[self.key][i])
|
labels.append(consts[self.key][i])
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
|
||||||
class Contact(_Contact):
|
class Contact(_Contact):
|
||||||
TABLE = OrderedDict((
|
TABLE = OrderedDict((
|
||||||
('_info', OrderedDict((
|
('_info', OrderedDict((
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class UnavailablePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserUnavailable()
|
raise BrowserUnavailable()
|
||||||
|
|
||||||
|
|
||||||
class VirtKeyboard(MappedVirtKeyboard):
|
class VirtKeyboard(MappedVirtKeyboard):
|
||||||
symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3',
|
symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3',
|
||||||
'1':'3495abaf658dc550e51c5c92ea56b60b',
|
'1':'3495abaf658dc550e51c5c92ea56b60b',
|
||||||
|
|
@ -148,6 +149,7 @@ class AccountsPage(BasePage):
|
||||||
account._args = args
|
account._args = args
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RET(RAIT) DAB (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
PATTERNS = [(re.compile('^RET(RAIT) DAB (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class AXABanqueTest(BackendTest):
|
class AXABanqueTest(BackendTest):
|
||||||
BACKEND = 'axabanque'
|
BACKEND = 'axabanque'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ class UnavailablePage(BasePage):
|
||||||
else:
|
else:
|
||||||
self.browser.location(a.attrib['href'])
|
self.browser.location(a.attrib['href'])
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
def login(self, login, passwd):
|
def login(self, login, passwd):
|
||||||
self.browser.select_form(name='Login')
|
self.browser.select_form(name='Login')
|
||||||
|
|
@ -46,6 +47,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING)
|
self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(BasePage):
|
class IndexPage(BasePage):
|
||||||
def get_token(self):
|
def get_token(self):
|
||||||
url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src']
|
url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src']
|
||||||
|
|
@ -53,6 +55,7 @@ class IndexPage(BasePage):
|
||||||
args = dict(parse_qsl(v.query))
|
args = dict(parse_qsl(v.query))
|
||||||
return args['token']
|
return args['token']
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS,
|
ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS,
|
||||||
u'Mes comptes': Account.TYPE_CHECKING,
|
u'Mes comptes': Account.TYPE_CHECKING,
|
||||||
|
|
@ -101,6 +104,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RET DAB (?P<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
|
PATTERNS = [(re.compile('^RET DAB (?P<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BanquePopulaireTest(BackendTest):
|
class BanquePopulaireTest(BackendTest):
|
||||||
BACKEND = 'banquepopulaire'
|
BACKEND = 'banquepopulaire'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class LoginPage(BasePage):
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Login2Page(BasePage):
|
class Login2Page(BasePage):
|
||||||
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()
|
||||||
|
|
@ -55,9 +56,11 @@ class Login2Page(BasePage):
|
||||||
self.browser['word'] = letters
|
self.browser['word'] = letters
|
||||||
self.browser.submit(name='valider', nologin=True)
|
self.browser.submit(name='valider', nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(BasePage):
|
class IndexPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
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,
|
||||||
|
|
@ -170,11 +173,13 @@ class Transaction(FrenchTransaction):
|
||||||
FrenchTransaction.TYPE_UNKNOWN),
|
FrenchTransaction.TYPE_UNKNOWN),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class HistoryBasePage(BasePage):
|
class HistoryBasePage(BasePage):
|
||||||
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([])
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(HistoryBasePage):
|
class TransactionsPage(HistoryBasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||||
|
|
@ -229,11 +234,14 @@ class CardPage(HistoryBasePage):
|
||||||
t.set_amount(amount)
|
t.set_amount(amount)
|
||||||
yield t
|
yield t
|
||||||
|
|
||||||
|
|
||||||
class ValuationPage(HistoryBasePage):
|
class ValuationPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LoanPage(HistoryBasePage):
|
class LoanPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MarketPage(HistoryBasePage):
|
class MarketPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BarclaysTest(BackendTest):
|
class BarclaysTest(BackendTest):
|
||||||
BACKEND = 'barclays'
|
BACKEND = 'barclays'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard,VirtKeyboardErr
|
||||||
|
|
||||||
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
||||||
|
|
||||||
|
|
||||||
class BNPVirtKeyboard(MappedVirtKeyboard):
|
class BNPVirtKeyboard(MappedVirtKeyboard):
|
||||||
symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5',
|
symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5',
|
||||||
'1':'e10b58fc085f9683052d5a63c96fc912',
|
'1':'e10b58fc085f9683052d5a63c96fc912',
|
||||||
|
|
@ -100,10 +101,12 @@ class ConfirmPage(BasePage):
|
||||||
if m:
|
if m:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
|
||||||
|
|
||||||
class InfoMessagePage(BasePage):
|
class InfoMessagePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChangePasswordPage(BasePage):
|
class ChangePasswordPage(BasePage):
|
||||||
def change_password(self, current, new):
|
def change_password(self, current, new):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistory(BasePage):
|
class AccountHistory(BasePage):
|
||||||
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'):
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class Account(object):
|
||||||
self.send_checkbox = send_checkbox
|
self.send_checkbox = send_checkbox
|
||||||
self.receive_checkbox = receive_checkbox
|
self.receive_checkbox = receive_checkbox
|
||||||
|
|
||||||
|
|
||||||
class TransferPage(BasePage):
|
class TransferPage(BasePage):
|
||||||
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"]'):
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class ProAccountsList(BasePage):
|
||||||
COL_ID = 2
|
COL_ID = 2
|
||||||
COL_BALANCE = 3
|
COL_BALANCE = 3
|
||||||
COL_COMING = 5
|
COL_COMING = 5
|
||||||
|
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
for tr in self.document.xpath('//tr[@class="comptes"]'):
|
for tr in self.document.xpath('//tr[@class="comptes"]'):
|
||||||
cols = tr.findall('td')
|
cols = tr.findall('td')
|
||||||
|
|
@ -57,6 +58,7 @@ class ProAccountsList(BasePage):
|
||||||
|
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class ProAccountHistory(BasePage):
|
class ProAccountHistory(BasePage):
|
||||||
COL_DATE = 0
|
COL_DATE = 0
|
||||||
COL_LABEL = 1
|
COL_LABEL = 1
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from .account_history import AccountHistory
|
||||||
from .accounts_list import AccountsList
|
from .accounts_list import AccountsList
|
||||||
from .login import LoginPage, UpdateInfoPage
|
from .login import LoginPage, UpdateInfoPage
|
||||||
|
|
||||||
|
|
||||||
class AccountPrelevement(AccountsList):
|
class AccountPrelevement(AccountsList):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
|
|
||||||
__all__ = ['AccountHistory']
|
__all__ = ['AccountHistory']
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile(u'^CHQ\. (?P<text>.*)'), FrenchTransaction.TYPE_CHECK),
|
PATTERNS = [(re.compile(u'^CHQ\. (?P<text>.*)'), FrenchTransaction.TYPE_CHECK),
|
||||||
(re.compile('^(ACHAT|PAIEMENT) CARTE (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2}) (?P<text>.*)'),
|
(re.compile('^(ACHAT|PAIEMENT) CARTE (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2}) (?P<text>.*)'),
|
||||||
|
|
@ -42,6 +43,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^REM CHQ (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^REM CHQ (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistory(BasePage):
|
class AccountHistory(BasePage):
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ class VirtKeyboard(MappedVirtKeyboard):
|
||||||
s += " "
|
s += " "
|
||||||
return hashlib.md5(s).hexdigest()
|
return hashlib.md5(s).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
@ -98,6 +99,7 @@ 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(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserIncorrectPassword('Please update your user informations')
|
raise BrowserIncorrectPassword('Please update your user informations')
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BoursoramaTest(BackendTest):
|
class BoursoramaTest(BackendTest):
|
||||||
BACKEND = 'boursorama'
|
BACKEND = 'boursorama'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BouyguesTest(BackendTest):
|
class BouyguesTest(BackendTest):
|
||||||
BACKEND = 'bouygues'
|
BACKEND = 'bouygues'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^(?P<category>REMISE DE CHEQUE) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^(?P<category>REMISE DE CHEQUE) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistory(BasePage):
|
class AccountHistory(BasePage):
|
||||||
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"]'):
|
||||||
|
|
@ -105,6 +106,7 @@ class AccountHistory(BasePage):
|
||||||
operations.append(op)
|
operations.append(op)
|
||||||
return operations
|
return operations
|
||||||
|
|
||||||
|
|
||||||
class CardsList(BasePage):
|
class CardsList(BasePage):
|
||||||
def get_cards(self):
|
def get_cards(self):
|
||||||
cards = []
|
cards = []
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ def md5(f):
|
||||||
md5.update(f.read())
|
md5.update(f.read())
|
||||||
return md5.hexdigest()
|
return md5.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
class UnavailablePage(BasePage):
|
class UnavailablePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserUnavailable()
|
raise BrowserUnavailable()
|
||||||
|
|
@ -57,14 +58,17 @@ class LoginPage(BasePage):
|
||||||
self.browser['username'] = login
|
self.browser['username'] = login
|
||||||
self.browser.submit()
|
self.browser.submit()
|
||||||
|
|
||||||
|
|
||||||
class repositionnerCheminCourant(BasePage):
|
class repositionnerCheminCourant(BasePage):
|
||||||
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(BasePage):
|
||||||
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(BasePage):
|
||||||
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")
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['pass'] = passwd.encode(self.browser.ENCODING)
|
self.browser['pass'] = passwd.encode(self.browser.ENCODING)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class LoginResultPage(BasePage):
|
class LoginResultPage(BasePage):
|
||||||
def confirm(self):
|
def confirm(self):
|
||||||
self.browser.location('MainAuth?typeDemande=AC', no_login=True)
|
self.browser.location('MainAuth?typeDemande=AC', no_login=True)
|
||||||
|
|
@ -52,9 +53,11 @@ class LoginResultPage(BasePage):
|
||||||
|
|
||||||
return error.text.strip()
|
return error.text.strip()
|
||||||
|
|
||||||
|
|
||||||
class EmptyPage(BasePage):
|
class EmptyPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BredBasePage(BasePage):
|
class BredBasePage(BasePage):
|
||||||
def js2args(self, s):
|
def js2args(self, s):
|
||||||
cur_arg = None
|
cur_arg = None
|
||||||
|
|
@ -70,6 +73,7 @@ class BredBasePage(BasePage):
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BredBasePage):
|
class AccountsPage(BredBasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
accounts = []
|
accounts = []
|
||||||
|
|
@ -123,6 +127,7 @@ class AccountsPage(BredBasePage):
|
||||||
|
|
||||||
return accounts
|
return accounts
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RETRAIT G.A.B. \d+ (?P<text>.*?)( CARTE .*)? LE (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{2}).*'),
|
PATTERNS = [(re.compile('^RETRAIT G.A.B. \d+ (?P<text>.*?)( CARTE .*)? LE (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{2}).*'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BredTest(BackendTest):
|
class BredTest(BackendTest):
|
||||||
BACKEND = 'bred'
|
BACKEND = 'bred'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ class TorrentsPage(BasePage):
|
||||||
yield torrent
|
yield torrent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TorrentPage(BasePage):
|
class TorrentPage(BasePage):
|
||||||
def get_torrent(self):
|
def get_torrent(self):
|
||||||
seed = 0
|
seed = 0
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from weboob.capabilities.base import NotLoaded
|
||||||
|
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
class BtmonTest(BackendTest):
|
class BtmonTest(BackendTest):
|
||||||
BACKEND = 'btmon'
|
BACKEND = 'btmon'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class LoginPage(BasePage):
|
||||||
self.browser.form.action = m.group(1)
|
self.browser.form.action = m.group(1)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class ErrorPage(BasePage):
|
class ErrorPage(BasePage):
|
||||||
def get_error(self):
|
def get_error(self):
|
||||||
try:
|
try:
|
||||||
|
|
@ -61,6 +62,7 @@ class ErrorPage(BasePage):
|
||||||
except BrokenPageError:
|
except BrokenPageError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class UnavailablePage(BasePage):
|
class UnavailablePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
try:
|
try:
|
||||||
|
|
@ -68,6 +70,7 @@ class UnavailablePage(BasePage):
|
||||||
except BrokenPageError:
|
except BrokenPageError:
|
||||||
raise BrowserUnavailable()
|
raise BrowserUnavailable()
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^CB (?P<text>.*?) FACT (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2})'),
|
PATTERNS = [(re.compile('^CB (?P<text>.*?) FACT (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2})'),
|
||||||
FrenchTransaction.TYPE_CARD),
|
FrenchTransaction.TYPE_CARD),
|
||||||
|
|
@ -87,6 +90,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^CB [\d\*]+ (?P<text>.*)'), FrenchTransaction.TYPE_CARD),
|
(re.compile('^CB [\d\*]+ (?P<text>.*)'), FrenchTransaction.TYPE_CARD),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(BasePage):
|
class IndexPage(BasePage):
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CaisseEpargneTest(BackendTest):
|
class CaisseEpargneTest(BackendTest):
|
||||||
BACKEND = 'caissedepargne'
|
BACKEND = 'caissedepargne'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
from weboob.capabilities.video import BaseVideo
|
from weboob.capabilities.video import BaseVideo
|
||||||
|
|
||||||
|
|
||||||
class CanalPlusTest(BackendTest):
|
class CanalPlusTest(BackendTest):
|
||||||
BACKEND = 'canalplus'
|
BACKEND = 'canalplus'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CanalTPTest(BackendTest):
|
class CanalTPTest(BackendTest):
|
||||||
BACKEND = 'canaltp'
|
BACKEND = 'canaltp'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,11 @@ class LoginPage(BasePage):
|
||||||
except FormNotFoundError:
|
except FormNotFoundError:
|
||||||
raise BrowserIncorrectPassword()
|
raise BrowserIncorrectPassword()
|
||||||
|
|
||||||
|
|
||||||
class HomePage(BasePage):
|
class HomePage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
div = self.document.xpath('//div[@id="descriptifdroite"]')[0]
|
div = self.document.xpath('//div[@id="descriptifdroite"]')[0]
|
||||||
|
|
@ -73,6 +75,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(BasePage):
|
class TransactionsPage(BasePage):
|
||||||
COL_DATE = 0
|
COL_DATE = 0
|
||||||
COL_TEXT = 1
|
COL_TEXT = 1
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CarrefourBanqueTest(BackendTest):
|
class CarrefourBanqueTest(BackendTest):
|
||||||
BACKEND = 'carrefourbanque'
|
BACKEND = 'carrefourbanque'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ 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(BasePage):
|
||||||
def login(self, login, passwd):
|
def login(self, login, passwd):
|
||||||
self.browser.select_form(name='ident')
|
self.browser.select_form(name='ident')
|
||||||
|
|
@ -35,25 +36,32 @@ class LoginPage(BasePage):
|
||||||
self.browser['_cm_pwd'] = passwd
|
self.browser['_cm_pwd'] = passwd
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class LoginErrorPage(BasePage):
|
class LoginErrorPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChangePasswordPage(BasePage):
|
class ChangePasswordPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserIncorrectPassword('Please change your password')
|
raise BrowserIncorrectPassword('Please change your password')
|
||||||
|
|
||||||
|
|
||||||
class InfoPage(BasePage):
|
class InfoPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EmptyPage(BasePage):
|
class EmptyPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TransfertPage(BasePage):
|
class TransfertPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class UserSpacePage(BasePage):
|
class UserSpacePage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
accounts = OrderedDict()
|
accounts = OrderedDict()
|
||||||
|
|
@ -102,6 +110,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
return accounts.itervalues()
|
return accounts.itervalues()
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||||
|
|
@ -116,6 +125,7 @@ class Transaction(FrenchTransaction):
|
||||||
|
|
||||||
_is_coming = False
|
_is_coming = False
|
||||||
|
|
||||||
|
|
||||||
class OperationsPage(BasePage):
|
class OperationsPage(BasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
index = 0
|
index = 0
|
||||||
|
|
@ -181,6 +191,7 @@ class OperationsPage(BasePage):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class CardPage(OperationsPage):
|
class CardPage(OperationsPage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
index = 0
|
index = 0
|
||||||
|
|
@ -200,6 +211,7 @@ class CardPage(OperationsPage):
|
||||||
tr.set_amount(tds[-1].text)
|
tr.set_amount(tds[-1].text)
|
||||||
yield tr
|
yield tr
|
||||||
|
|
||||||
|
|
||||||
class NoOperationsPage(OperationsPage):
|
class NoOperationsPage(OperationsPage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CICTest(BackendTest):
|
class CICTest(BackendTest):
|
||||||
BACKEND = 'cic'
|
BACKEND = 'cic'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ __all__ = ['HTTPSVerifiedConnection', 'HellHTTPS']
|
||||||
|
|
||||||
PROXY_PORT = 8080
|
PROXY_PORT = 8080
|
||||||
|
|
||||||
|
|
||||||
class HTTPSVerifiedConnection(httplib.HTTPSConnection):
|
class HTTPSVerifiedConnection(httplib.HTTPSConnection):
|
||||||
"""
|
"""
|
||||||
This class allows communication via SSL, and will checks certificates
|
This class allows communication via SSL, and will checks certificates
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['motDePasse'] = passwd.encode(self.browser.ENCODING)
|
self.browser['motDePasse'] = passwd.encode(self.browser.ENCODING)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
names = set()
|
names = set()
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CmsoTest(BackendTest):
|
class CmsoTest(BackendTest):
|
||||||
BACKEND = 'cmso'
|
BACKEND = 'cmso'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import mechanize
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
class Cragr(BaseBrowser):
|
class Cragr(BaseBrowser):
|
||||||
PROTOCOL = 'https'
|
PROTOCOL = 'https'
|
||||||
ENCODING = 'utf-8'
|
ENCODING = 'utf-8'
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ from .base import CragrBasePage
|
||||||
from .tokenextractor import TokenExtractor
|
from .tokenextractor import TokenExtractor
|
||||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [
|
PATTERNS = [
|
||||||
(re.compile('^(Vp|Vt|Vrt|Virt|Vir(ement)?)\s*(?P<text>.*)', re.IGNORECASE), FrenchTransaction.TYPE_TRANSFER),
|
(re.compile('^(Vp|Vt|Vrt|Virt|Vir(ement)?)\s*(?P<text>.*)', re.IGNORECASE), FrenchTransaction.TYPE_TRANSFER),
|
||||||
|
|
@ -44,6 +45,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^RET.CARTE (?P<text>.*)', re.IGNORECASE), FrenchTransaction.TYPE_WITHDRAWAL),
|
(re.compile('^RET.CARTE (?P<text>.*)', re.IGNORECASE), FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountsList(CragrBasePage):
|
class AccountsList(CragrBasePage):
|
||||||
"""
|
"""
|
||||||
Unlike most pages used with the Browser class, this class represents
|
Unlike most pages used with the Browser class, this class represents
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
from weboob.tools.browser import BrowserUnavailable
|
from weboob.tools.browser import BrowserUnavailable
|
||||||
|
|
||||||
|
|
||||||
class CragrBasePage(BasePage):
|
class CragrBasePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
# Check for an error
|
# Check for an error
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,19 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
|
|
||||||
class TokenExtractor:
|
class TokenExtractor:
|
||||||
""" Extracts texts token from an HTML document """
|
""" Extracts texts token from an HTML document """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.iterated_elements = []
|
self.iterated_elements = []
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
"""
|
"""
|
||||||
Reset any content stored within a TokenExtractor object. Useful to start
|
Reset any content stored within a TokenExtractor object. Useful to start
|
||||||
a new parsing without creating a new instance.
|
a new parsing without creating a new instance.
|
||||||
"""
|
"""
|
||||||
self.iterated_elements = []
|
self.iterated_elements = []
|
||||||
|
|
||||||
def element_iterated_already(self, html_element):
|
def element_iterated_already(self, html_element):
|
||||||
if html_element in self.iterated_elements:
|
if html_element in self.iterated_elements:
|
||||||
return True
|
return True
|
||||||
|
|
@ -34,6 +37,7 @@ class TokenExtractor:
|
||||||
if ancestor in self.iterated_elements:
|
if ancestor in self.iterated_elements:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def extract_tokens(self, html_element):
|
def extract_tokens(self, html_element):
|
||||||
if self.element_iterated_already(html_element):
|
if self.element_iterated_already(html_element):
|
||||||
return
|
return
|
||||||
|
|
@ -44,10 +48,12 @@ class TokenExtractor:
|
||||||
for token in self.split_text_into_smaller_tokens(text):
|
for token in self.split_text_into_smaller_tokens(text):
|
||||||
if self.token_looks_relevant(token):
|
if self.token_looks_relevant(token):
|
||||||
yield token.strip()
|
yield token.strip()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def split_text_into_smaller_tokens(text):
|
def split_text_into_smaller_tokens(text):
|
||||||
for subtext1 in text.split('\t'):
|
for subtext1 in text.split('\t'):
|
||||||
yield subtext1
|
yield subtext1
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def token_looks_relevant(token):
|
def token_looks_relevant(token):
|
||||||
return len(token.strip()) > 1
|
return len(token.strip()) > 1
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CrAgrTest(BackendTest):
|
class CrAgrTest(BackendTest):
|
||||||
BACKEND = 'cragr'
|
BACKEND = 'cragr'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['j_password'] = password.encode('iso-8859-15')
|
self.browser['j_password'] = password.encode('iso-8859-15')
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class LoggedPage(BasePage):
|
class LoggedPage(BasePage):
|
||||||
def get_error(self):
|
def get_error(self):
|
||||||
div = self.document.xpath('//div[@class="errorForm-msg"]')
|
div = self.document.xpath('//div[@class="errorForm-msg"]')
|
||||||
|
|
@ -46,6 +47,7 @@ class LoggedPage(BasePage):
|
||||||
msg = u', '.join([li.text.strip() for li in div[0].xpath('.//li')])
|
msg = u', '.join([li.text.strip() for li in div[0].xpath('.//li')])
|
||||||
return re.sub('[\r\n\t\xa0]+', ' ', msg)
|
return re.sub('[\r\n\t\xa0]+', ' ', msg)
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
||||||
|
|
||||||
|
|
@ -65,6 +67,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^(?P<text>RETRAIT DAB) (?P<dd>\d{2})-(?P<mm>\d{2})-([\d\-]+)'),
|
PATTERNS = [(re.compile('^(?P<text>RETRAIT DAB) (?P<dd>\d{2})-(?P<mm>\d{2})-([\d\-]+)'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
@ -88,9 +91,11 @@ class Transaction(FrenchTransaction):
|
||||||
FrenchTransaction.TYPE_UNKNOWN),
|
FrenchTransaction.TYPE_UNKNOWN),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(BasePage):
|
class TransactionsPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TransactionsJSONPage(BasePage):
|
class TransactionsJSONPage(BasePage):
|
||||||
ROW_DATE = 0
|
ROW_DATE = 0
|
||||||
ROW_TEXT = 2
|
ROW_TEXT = 2
|
||||||
|
|
@ -104,6 +109,7 @@ class TransactionsJSONPage(BasePage):
|
||||||
t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT])
|
t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT])
|
||||||
yield t
|
yield t
|
||||||
|
|
||||||
|
|
||||||
class ComingTransactionsPage(BasePage):
|
class ComingTransactionsPage(BasePage):
|
||||||
ROW_REF = 0
|
ROW_REF = 0
|
||||||
ROW_TEXT = 1
|
ROW_TEXT = 1
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
|
|
||||||
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage']
|
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage']
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
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
|
||||||
|
|
@ -41,6 +42,7 @@ class LoginPage(BasePage):
|
||||||
assert self.browser['identType'] == indentType
|
assert self.browser['identType'] == indentType
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
||||||
|
|
||||||
|
|
@ -77,6 +79,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RETRAIT DAB (?P<text>.*?).*'),
|
PATTERNS = [(re.compile('^RETRAIT DAB (?P<text>.*?).*'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
@ -95,6 +98,7 @@ class Transaction(FrenchTransaction):
|
||||||
FrenchTransaction.TYPE_UNKNOWN),
|
FrenchTransaction.TYPE_UNKNOWN),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(BasePage):
|
class TransactionsPage(BasePage):
|
||||||
def get_next_url(self):
|
def get_next_url(self):
|
||||||
# can be 'Suivant' or ' Suivant'
|
# can be 'Suivant' or ' Suivant'
|
||||||
|
|
@ -109,6 +113,7 @@ class TransactionsPage(BasePage):
|
||||||
TR_TEXT = 2
|
TR_TEXT = 2
|
||||||
TR_DEBIT = 3
|
TR_DEBIT = 3
|
||||||
TR_CREDIT = 4
|
TR_CREDIT = 4
|
||||||
|
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||||
tds = tr.findall('td')
|
tds = tr.findall('td')
|
||||||
|
|
@ -129,6 +134,7 @@ class TransactionsPage(BasePage):
|
||||||
|
|
||||||
yield t
|
yield t
|
||||||
|
|
||||||
|
|
||||||
class ComingTransactionsPage(BasePage):
|
class ComingTransactionsPage(BasePage):
|
||||||
COM_TR_COMMENT = 0
|
COM_TR_COMMENT = 0
|
||||||
COM_TR_DATE = 1
|
COM_TR_DATE = 1
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CreditCooperatifTest(BackendTest):
|
class CreditCooperatifTest(BackendTest):
|
||||||
BACKEND = 'creditcooperatif'
|
BACKEND = 'creditcooperatif'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ __all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage']
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CDNBasePage(BasePage):
|
class CDNBasePage(BasePage):
|
||||||
def get_from_js(self, pattern, end, is_list=False):
|
def get_from_js(self, pattern, end, is_list=False):
|
||||||
"""
|
"""
|
||||||
|
|
@ -69,6 +70,7 @@ class CDNBasePage(BasePage):
|
||||||
def get_execution(self):
|
def get_execution(self):
|
||||||
return self.get_from_js("name: 'execution', value: '", "'")
|
return self.get_from_js("name: 'execution', value: '", "'")
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(CDNBasePage):
|
class AccountsPage(CDNBasePage):
|
||||||
COL_HISTORY = 2
|
COL_HISTORY = 2
|
||||||
COL_ID = 4
|
COL_ID = 4
|
||||||
|
|
@ -113,6 +115,7 @@ class AccountsPage(CDNBasePage):
|
||||||
|
|
||||||
return iter(accounts)
|
return iter(accounts)
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile(r'^(?P<text>RET DAB \w+ .*?) LE (?P<dd>\d{2})(?P<mm>\d{2})$'),
|
PATTERNS = [(re.compile(r'^(?P<text>RET DAB \w+ .*?) LE (?P<dd>\d{2})(?P<mm>\d{2})$'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CreditDuNordTest(BackendTest):
|
class CreditDuNordTest(BackendTest):
|
||||||
BACKEND = 'creditdunord'
|
BACKEND = 'creditdunord'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ 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(BasePage):
|
||||||
def login(self, login, passwd):
|
def login(self, login, passwd):
|
||||||
self.browser.select_form(nr=0)
|
self.browser.select_form(nr=0)
|
||||||
|
|
@ -35,25 +36,32 @@ class LoginPage(BasePage):
|
||||||
self.browser['_cm_pwd'] = passwd
|
self.browser['_cm_pwd'] = passwd
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class LoginErrorPage(BasePage):
|
class LoginErrorPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChangePasswordPage(BasePage):
|
class ChangePasswordPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserIncorrectPassword('Please change your password')
|
raise BrowserIncorrectPassword('Please change your password')
|
||||||
|
|
||||||
|
|
||||||
class InfoPage(BasePage):
|
class InfoPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EmptyPage(BasePage):
|
class EmptyPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TransfertPage(BasePage):
|
class TransfertPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class UserSpacePage(BasePage):
|
class UserSpacePage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
accounts = OrderedDict()
|
accounts = OrderedDict()
|
||||||
|
|
@ -102,6 +110,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
return accounts.itervalues()
|
return accounts.itervalues()
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||||
|
|
@ -116,6 +125,7 @@ class Transaction(FrenchTransaction):
|
||||||
|
|
||||||
_is_coming = False
|
_is_coming = False
|
||||||
|
|
||||||
|
|
||||||
class OperationsPage(BasePage):
|
class OperationsPage(BasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
index = 0
|
index = 0
|
||||||
|
|
@ -181,6 +191,7 @@ class OperationsPage(BasePage):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class CardPage(OperationsPage):
|
class CardPage(OperationsPage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
index = 0
|
index = 0
|
||||||
|
|
@ -200,6 +211,7 @@ class CardPage(OperationsPage):
|
||||||
tr.set_amount(tds[-1].text)
|
tr.set_amount(tds[-1].text)
|
||||||
yield tr
|
yield tr
|
||||||
|
|
||||||
|
|
||||||
class NoOperationsPage(OperationsPage):
|
class NoOperationsPage(OperationsPage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class CreditMutuelTest(BackendTest):
|
class CreditMutuelTest(BackendTest):
|
||||||
BACKEND = 'creditmutuel'
|
BACKEND = 'creditmutuel'
|
||||||
|
|
||||||
|
|
@ -28,5 +29,3 @@ class CreditMutuelTest(BackendTest):
|
||||||
if len(l) > 0:
|
if len(l) > 0:
|
||||||
a = l[0]
|
a = l[0]
|
||||||
list(self.backend.iter_history(a))
|
list(self.backend.iter_history(a))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ class DailymotionBackend(BaseBackend, ICapVideo, ICapCollection):
|
||||||
return self.browser.get_video(_id)
|
return self.browser.get_video(_id)
|
||||||
|
|
||||||
SORTBY = ['relevance', 'rated', 'visited', None]
|
SORTBY = ['relevance', 'rated', 'visited', None]
|
||||||
|
|
||||||
def search_videos(self, pattern, sortby=ICapVideo.SEARCH_RELEVANCE, nsfw=False, max_results=None):
|
def search_videos(self, pattern, sortby=ICapVideo.SEARCH_RELEVANCE, nsfw=False, max_results=None):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
return self.browser.search_videos(pattern, self.SORTBY[sortby])
|
return self.browser.search_videos(pattern, self.SORTBY[sortby])
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ class IndexPage(BasePage):
|
||||||
self.browser.logger.warning('Unable to parse rating: %s' % div.attrib['style'])
|
self.browser.logger.warning('Unable to parse rating: %s' % div.attrib['style'])
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
def get_video(self, video=None):
|
def get_video(self, video=None):
|
||||||
if video is None:
|
if video is None:
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent):
|
||||||
date=com.date,
|
date=com.date,
|
||||||
parent=parent,
|
parent=parent,
|
||||||
content=com.body,
|
content=com.body,
|
||||||
signature=com.signature + \
|
signature=com.signature +
|
||||||
'<br />'.join(['Score: %d' % com.score,
|
'<br />'.join(['Score: %d' % com.score,
|
||||||
'URL: %s' % com.url]),
|
'URL: %s' % com.url]),
|
||||||
children=[],
|
children=[],
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ from .pages.wiki import WikiEditPage
|
||||||
from .tools import id2url, url2id
|
from .tools import id2url, url2id
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
|
|
||||||
|
|
||||||
class DLFP(BaseBrowser):
|
class DLFP(BaseBrowser):
|
||||||
DOMAIN = 'linuxfr.org'
|
DOMAIN = 'linuxfr.org'
|
||||||
PROTOCOL = 'https'
|
PROTOCOL = 'https'
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ from logging import warning
|
||||||
|
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
|
|
||||||
|
|
||||||
class Message(object):
|
class Message(object):
|
||||||
TIMESTAMP_REGEXP = re.compile(r'(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})')
|
TIMESTAMP_REGEXP = re.compile(r'(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})')
|
||||||
|
|
||||||
def __init__(self, id, timestamp, login, message, is_me):
|
def __init__(self, id, timestamp, login, message, is_me):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.timestamp = timestamp
|
self.timestamp = timestamp
|
||||||
|
|
@ -40,6 +42,7 @@ class Message(object):
|
||||||
else:
|
else:
|
||||||
warning('Unable to parse timestamp "%s"' % timestamp)
|
warning('Unable to parse timestamp "%s"' % timestamp)
|
||||||
|
|
||||||
|
|
||||||
class BoardIndexPage(BasePage):
|
class BoardIndexPage(BasePage):
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
|
|
||||||
|
|
||||||
class DLFPPage(BasePage):
|
class DLFPPage(BasePage):
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
for form in self.document.getiterator('form'):
|
for form in self.document.getiterator('form'):
|
||||||
|
|
@ -28,6 +29,7 @@ class DLFPPage(BasePage):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(DLFPPage):
|
class IndexPage(DLFPPage):
|
||||||
def get_login_token(self):
|
def get_login_token(self):
|
||||||
form = self.parser.select(self.document.getroot(), 'form#new_account_sidebar', 1)
|
form = self.parser.select(self.document.getroot(), 'form#new_account_sidebar', 1)
|
||||||
|
|
@ -35,5 +37,6 @@ class IndexPage(DLFPPage):
|
||||||
if i.attrib['name'] == 'authenticity_token':
|
if i.attrib['name'] == 'authenticity_token':
|
||||||
return i.attrib['value']
|
return i.attrib['value']
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(DLFPPage):
|
class LoginPage(DLFPPage):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,12 @@ from ..tools import url2id
|
||||||
|
|
||||||
from .index import DLFPPage
|
from .index import DLFPPage
|
||||||
|
|
||||||
|
|
||||||
class RSSComment(DLFPPage):
|
class RSSComment(DLFPPage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Content(object):
|
class Content(object):
|
||||||
TAGGABLE = False
|
TAGGABLE = False
|
||||||
|
|
||||||
|
|
@ -50,6 +52,7 @@ class Content(object):
|
||||||
def is_taggable(self):
|
def is_taggable(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Comment(Content):
|
class Comment(Content):
|
||||||
def __init__(self, article, div, reply_id):
|
def __init__(self, article, div, reply_id):
|
||||||
Content.__init__(self, article.browser)
|
Content.__init__(self, article.browser)
|
||||||
|
|
@ -105,6 +108,7 @@ class Comment(Content):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return u"<Comment id=%r author=%r title=%r>" % (self.id, self.author, self.title)
|
return u"<Comment id=%r author=%r title=%r>" % (self.id, self.author, self.title)
|
||||||
|
|
||||||
|
|
||||||
class Article(Content):
|
class Article(Content):
|
||||||
TAGGABLE = True
|
TAGGABLE = True
|
||||||
|
|
||||||
|
|
@ -149,11 +153,13 @@ class Article(Content):
|
||||||
for c in comment.iter_all_comments():
|
for c in comment.iter_all_comments():
|
||||||
yield c
|
yield c
|
||||||
|
|
||||||
|
|
||||||
class CommentPage(DLFPPage):
|
class CommentPage(DLFPPage):
|
||||||
def get_comment(self):
|
def get_comment(self):
|
||||||
article = Article(self.browser, self.url, None)
|
article = Article(self.browser, self.url, None)
|
||||||
return Comment(article, self.parser.select(self.document.getroot(), 'li.comment', 1), 0)
|
return Comment(article, self.parser.select(self.document.getroot(), 'li.comment', 1), 0)
|
||||||
|
|
||||||
|
|
||||||
class ContentPage(DLFPPage):
|
class ContentPage(DLFPPage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
self.article = None
|
self.article = None
|
||||||
|
|
@ -192,9 +198,11 @@ class ContentPage(DLFPPage):
|
||||||
def get_tag_url(self):
|
def get_tag_url(self):
|
||||||
return self.parser.select(self.document.getroot(), 'div.tag_in_place', 1).find('a').attrib['href']
|
return self.parser.select(self.document.getroot(), 'div.tag_in_place', 1).find('a').attrib['href']
|
||||||
|
|
||||||
|
|
||||||
class NewCommentPage(DLFPPage):
|
class NewCommentPage(DLFPPage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NewTagPage(DLFPPage):
|
class NewTagPage(DLFPPage):
|
||||||
def _is_tag_form(self, form):
|
def _is_tag_form(self, form):
|
||||||
return form.action.endswith('/tags')
|
return form.action.endswith('/tags')
|
||||||
|
|
@ -204,6 +212,7 @@ class NewTagPage(DLFPPage):
|
||||||
self.browser['tags'] = tag
|
self.browser['tags'] = tag
|
||||||
self.browser.submit()
|
self.browser.submit()
|
||||||
|
|
||||||
|
|
||||||
class NodePage(DLFPPage):
|
class NodePage(DLFPPage):
|
||||||
def get_errors(self):
|
def get_errors(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ from weboob.tools.browser import BrokenPageError
|
||||||
|
|
||||||
from .index import DLFPPage
|
from .index import DLFPPage
|
||||||
|
|
||||||
|
|
||||||
class WikiEditPage(DLFPPage):
|
class WikiEditPage(DLFPPage):
|
||||||
def get_body(self):
|
def get_body(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,11 @@ REGEXPS = {'/users/%s/journaux/%s': 'D%s.%s',
|
||||||
'/forums/%s/posts/%s': 'B%s.%s',
|
'/forums/%s/posts/%s': 'B%s.%s',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def f2re(f):
|
def f2re(f):
|
||||||
return '.*' + f.replace('%s', '([^ /]+)')
|
return '.*' + f.replace('%s', '([^ /]+)')
|
||||||
|
|
||||||
|
|
||||||
def rssid(entry):
|
def rssid(entry):
|
||||||
m = RSSID_RE.match(entry.id)
|
m = RSSID_RE.match(entry.id)
|
||||||
if not m:
|
if not m:
|
||||||
|
|
@ -53,6 +55,7 @@ def rssid(entry):
|
||||||
else:
|
else:
|
||||||
return '%s.%s' % (ind, m.group(2))
|
return '%s.%s' % (ind, m.group(2))
|
||||||
|
|
||||||
|
|
||||||
def id2url(id):
|
def id2url(id):
|
||||||
m = ID2URL_RE.match(id)
|
m = ID2URL_RE.match(id)
|
||||||
if not m:
|
if not m:
|
||||||
|
|
@ -67,6 +70,7 @@ def id2url(id):
|
||||||
else:
|
else:
|
||||||
return url_re % m.group(3)
|
return url_re % m.group(3)
|
||||||
|
|
||||||
|
|
||||||
def url2id(url):
|
def url2id(url):
|
||||||
for url_re, id_re in REGEXPS.iteritems():
|
for url_re, id_re in REGEXPS.iteritems():
|
||||||
m = re.match(f2re(url_re), url)
|
m = re.match(f2re(url_re), url)
|
||||||
|
|
@ -75,6 +79,7 @@ def url2id(url):
|
||||||
|
|
||||||
return id_re % m.groups()
|
return id_re % m.groups()
|
||||||
|
|
||||||
|
|
||||||
def id2threadid(id):
|
def id2threadid(id):
|
||||||
m = ID2URL_RE.match(id)
|
m = ID2URL_RE.match(id)
|
||||||
if m:
|
if m:
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ __all__ = ['StartPage']
|
||||||
|
|
||||||
|
|
||||||
class StartPage(BasePage):
|
class StartPage(BasePage):
|
||||||
name = [u"Temperatur", u"Wind", u"Luftdruck", u"Luftfeuchtigkeit",\
|
name = [u"Temperatur", u"Wind", u"Luftdruck", u"Luftfeuchtigkeit",
|
||||||
u"Niederschlag", u"Globalstrahlung", u"Schneehoehe"]
|
u"Niederschlag", u"Globalstrahlung", u"Schneehoehe"]
|
||||||
unit = [u"°C", u"km/h", u"hPa", u"%", u"mm", u"W/m²", u"cm"]
|
unit = [u"°C", u"km/h", u"hPa", u"%", u"mm", u"W/m²", u"cm"]
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ class StartPage(BasePage):
|
||||||
lastvalue.level = float(text.split('\n')[2].split('hPa')[0])
|
lastvalue.level = float(text.split('\n')[2].split('hPa')[0])
|
||||||
if i == 3:
|
if i == 3:
|
||||||
text = paraph.xpath('span/font[@size="4"]/b')[0].text
|
text = paraph.xpath('span/font[@size="4"]/b')[0].text
|
||||||
lastvalue.level = float(text.split('\n')[2].split(u'%')[0]\
|
lastvalue.level = float(text.split('\n')[2].split(u'%')[0]
|
||||||
.split(':')[1])
|
.split(':')[1])
|
||||||
if i == 4:
|
if i == 4:
|
||||||
text = paraph.xpath('b/font[@size="4"]/span')[0].text
|
text = paraph.xpath('b/font[@size="4"]/span')[0].text
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ class EHentaiBackend(BaseBackend, ICapGallery, ICapCollection):
|
||||||
|
|
||||||
ID_REGEXP = r'/?\d+/[\dabcdef]+/?'
|
ID_REGEXP = r'/?\d+/[\dabcdef]+/?'
|
||||||
URL_REGEXP = r'.+/g/(%s)' % ID_REGEXP
|
URL_REGEXP = r'.+/g/(%s)' % ID_REGEXP
|
||||||
|
|
||||||
def get_gallery(self, _id):
|
def get_gallery(self, _id):
|
||||||
match = re.match(r'^%s$' % self.URL_REGEXP, _id)
|
match = re.match(r'^%s$' % self.URL_REGEXP, _id)
|
||||||
if match:
|
if match:
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,12 @@ from weboob.capabilities.gallery import BaseGallery, BaseImage
|
||||||
|
|
||||||
__all_ = ['EHentaiGallery', 'EHentaiImage']
|
__all_ = ['EHentaiGallery', 'EHentaiImage']
|
||||||
|
|
||||||
|
|
||||||
class EHentaiGallery(BaseGallery):
|
class EHentaiGallery(BaseGallery):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseGallery.__init__(self, *args, **kwargs)
|
BaseGallery.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class EHentaiImage(BaseImage):
|
class EHentaiImage(BaseImage):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseImage.__init__(self, *args, **kwargs)
|
BaseImage.__init__(self, *args, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ from .video import EuroparlVideo
|
||||||
|
|
||||||
__all__ = ['VideoPage']
|
__all__ = ['VideoPage']
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
def get_video(self, video=None):
|
def get_video(self, video=None):
|
||||||
if video is None:
|
if video is None:
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,3 @@ class EuroparlVideo(BaseVideo):
|
||||||
if m:
|
if m:
|
||||||
return u'http://www.europarl.europa.eu/ep-live/en/plenary/video?debate=%s' % _id
|
return u'http://www.europarl.europa.eu/ep-live/en/plenary/video?debate=%s' % _id
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ from .pages.accounts_list import GlobalAccountsList, AccountsList, AccountHistor
|
||||||
|
|
||||||
__all__ = ['Fortuneo']
|
__all__ = ['Fortuneo']
|
||||||
|
|
||||||
|
|
||||||
class Fortuneo(BaseBrowser):
|
class Fortuneo(BaseBrowser):
|
||||||
DOMAIN_LOGIN = 'www.fortuneo.fr'
|
DOMAIN_LOGIN = 'www.fortuneo.fr'
|
||||||
DOMAIN = 'www.fortuneo.fr'
|
DOMAIN = 'www.fortuneo.fr'
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistoryPage(BasePage):
|
class AccountHistoryPage(BasePage):
|
||||||
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"""
|
||||||
|
|
@ -85,6 +86,7 @@ class AccountHistoryPage(BasePage):
|
||||||
|
|
||||||
yield operation
|
yield operation
|
||||||
|
|
||||||
|
|
||||||
class AccountsList(BasePage):
|
class AccountsList(BasePage):
|
||||||
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"]')
|
||||||
|
|
@ -156,6 +158,7 @@ class AccountsList(BasePage):
|
||||||
|
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class GlobalAccountsList(BasePage):
|
class GlobalAccountsList(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ from weboob.tools.browser import BasePage, BrowserUnavailable
|
||||||
|
|
||||||
__all__ = ['LoginPage']
|
__all__ = ['LoginPage']
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
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()")
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class FortuneoTest(BackendTest):
|
class FortuneoTest(BackendTest):
|
||||||
BACKEND = 'fortuneo'
|
BACKEND = 'fortuneo'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
from logging import debug
|
from logging import debug
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class FourChanTest(BackendTest):
|
class FourChanTest(BackendTest):
|
||||||
BACKEND = 'fourchan'
|
BACKEND = 'fourchan'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
from weboob.capabilities.video import BaseVideo
|
from weboob.capabilities.video import BaseVideo
|
||||||
|
|
||||||
|
|
||||||
class PluzzTest(BackendTest):
|
class PluzzTest(BackendTest):
|
||||||
BACKEND = 'francetelevisions'
|
BACKEND = 'francetelevisions'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['LoginPortletFormPassword1'] = passwd.encode(self.browser.ENCODING)
|
self.browser['LoginPortletFormPassword1'] = passwd.encode(self.browser.ENCODING)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
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,
|
||||||
|
|
@ -89,6 +90,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('(?P<text>Int .*)'), FrenchTransaction.TYPE_BANK),
|
(re.compile('(?P<text>Int .*)'), FrenchTransaction.TYPE_BANK),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(BasePage):
|
class TransactionsPage(BasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class GanAssurancesTest(BackendTest):
|
class GanAssurancesTest(BackendTest):
|
||||||
BACKEND = 'ganassurances'
|
BACKEND = 'ganassurances'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class GazelleTest(BackendTest):
|
class GazelleTest(BackendTest):
|
||||||
BACKEND = 'gazelle'
|
BACKEND = 'gazelle'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ from .video import GDCVaultVideo
|
||||||
|
|
||||||
__all__ = ['VideoPage']
|
__all__ = ['VideoPage']
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
def get_video(self, video=None):
|
def get_video(self, video=None):
|
||||||
if video is None:
|
if video is None:
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,3 @@ class GDCVaultVideo(BaseVideo):
|
||||||
if m:
|
if m:
|
||||||
return u'http://www.gdcvault.com/play/%s#slides' % _id
|
return u'http://www.gdcvault.com/play/%s#slides' % _id
|
||||||
return u'http://www.gdcvault.com/play/%s' % _id
|
return u'http://www.gdcvault.com/play/%s' % _id
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class GeolocIPTest(BackendTest):
|
class GeolocIPTest(BackendTest):
|
||||||
BACKEND = 'geolocip'
|
BACKEND = 'geolocip'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ from weboob.tools.browser import BaseBrowser
|
||||||
from .pages import ValidationPage, HomePage, HistoryPage, StoryPage, AuthorPage
|
from .pages import ValidationPage, HomePage, HistoryPage, StoryPage, AuthorPage
|
||||||
|
|
||||||
# Browser
|
# Browser
|
||||||
|
|
||||||
|
|
||||||
class HDSBrowser(BaseBrowser):
|
class HDSBrowser(BaseBrowser):
|
||||||
ENCODING = 'ISO-8859-1'
|
ENCODING = 'ISO-8859-1'
|
||||||
DOMAIN = 'histoires-de-sexe.net'
|
DOMAIN = 'histoires-de-sexe.net'
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ __all__ = ['HSBC']
|
||||||
class NotLoggedPage(BasePage):
|
class NotLoggedPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HSBC(BaseBrowser):
|
class HSBC(BaseBrowser):
|
||||||
DOMAIN = 'client.hsbc.fr'
|
DOMAIN = 'client.hsbc.fr'
|
||||||
PROTOCOL = 'https'
|
PROTOCOL = 'https'
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ class AccountsListPage(BasePage):
|
||||||
|
|
||||||
return iter(accounts)
|
return iter(accounts)
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||||
|
|
@ -85,6 +86,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^REMISE (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^REMISE (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class HistoryPage(BasePage):
|
class HistoryPage(BasePage):
|
||||||
def get_next_link(self):
|
def get_next_link(self):
|
||||||
return None
|
return None
|
||||||
|
|
@ -92,6 +94,7 @@ class HistoryPage(BasePage):
|
||||||
def get_operations(self, num_page, date_guesser):
|
def get_operations(self, num_page, date_guesser):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
class CPTHistoryPage(HistoryPage):
|
class CPTHistoryPage(HistoryPage):
|
||||||
def get_operations(self, num_page, date_guesser):
|
def get_operations(self, num_page, date_guesser):
|
||||||
for script in self.document.getiterator('script'):
|
for script in self.document.getiterator('script'):
|
||||||
|
|
@ -105,6 +108,7 @@ class CPTHistoryPage(HistoryPage):
|
||||||
op._coming = (re.match('\d+/\d+/\d+', m.group(2)) is None)
|
op._coming = (re.match('\d+/\d+/\d+', m.group(2)) is None)
|
||||||
yield op
|
yield op
|
||||||
|
|
||||||
|
|
||||||
class CardHistoryPage(HistoryPage):
|
class CardHistoryPage(HistoryPage):
|
||||||
def get_next_link(self):
|
def get_next_link(self):
|
||||||
ok = False
|
ok = False
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class HSBCTest(BackendTest):
|
class HSBCTest(BackendTest):
|
||||||
BACKEND = 'hsbc'
|
BACKEND = 'hsbc'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,8 @@ dict_hex = {'á': u'á',
|
||||||
'â': u'â',
|
'â': u'â',
|
||||||
'ç': u'ç'
|
'ç': u'ç'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def latin2unicode(word):
|
def latin2unicode(word):
|
||||||
for key in dict_hex.keys():
|
for key in dict_hex.keys():
|
||||||
word = word.replace(key,dict_hex[key])
|
word = word.replace(key,dict_hex[key])
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ class PersonPage(BasePage):
|
||||||
person.thumbnail_url = thumbnail_url
|
person.thumbnail_url = thumbnail_url
|
||||||
return person
|
return person
|
||||||
|
|
||||||
|
|
||||||
class FilmographyPage(BasePage):
|
class FilmographyPage(BasePage):
|
||||||
''' Page of detailed filmography of a person, sorted by type of role
|
''' Page of detailed filmography of a person, sorted by type of role
|
||||||
This page is easier to parse than the main person page filmography
|
This page is easier to parse than the main person page filmography
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class ImdbTest(BackendTest):
|
class ImdbTest(BackendTest):
|
||||||
BACKEND = 'imdb'
|
BACKEND = 'imdb'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class INATest(BackendTest):
|
class INATest(BackendTest):
|
||||||
BACKEND = 'ina'
|
BACKEND = 'ina'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
|
|
||||||
__all__ = ['AccountsList']
|
__all__ = ['AccountsList']
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile(u'^retrait dab (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{4}) (?P<text>.*)'), FrenchTransaction.TYPE_WITHDRAWAL),
|
PATTERNS = [(re.compile(u'^retrait dab (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{4}) (?P<text>.*)'), FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
(re.compile(u'^carte (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{4}) (?P<text>.*)'), Transaction.TYPE_CARD),
|
(re.compile(u'^carte (?P<dd>\d{2})/(?P<mm>\d{2})/(?P<yy>\d{4}) (?P<text>.*)'), Transaction.TYPE_CARD),
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.GenericBackend import GenericNewspaperBa
|
||||||
from .browser import NewspaperInrocksBrowser
|
from .browser import NewspaperInrocksBrowser
|
||||||
from .tools import rssid
|
from .tools import rssid
|
||||||
|
|
||||||
|
|
||||||
class NewspaperInrocksBackend(GenericNewspaperBackend, ICapMessages):
|
class NewspaperInrocksBackend(GenericNewspaperBackend, ICapMessages):
|
||||||
MAINTAINER = u'Julien Hebert'
|
MAINTAINER = u'Julien Hebert'
|
||||||
EMAIL = 'juke@free.fr'
|
EMAIL = 'juke@free.fr'
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage, t
|
||||||
try_remove_from_selector_list, \
|
try_remove_from_selector_list, \
|
||||||
drop_comments, NoneMainDiv
|
drop_comments, NoneMainDiv
|
||||||
|
|
||||||
|
|
||||||
class ArticlePage(GenericNewsPage):
|
class ArticlePage(GenericNewsPage):
|
||||||
"ArticlePage object for inrocks"
|
"ArticlePage object for inrocks"
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage
|
from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage
|
||||||
|
|
||||||
|
|
||||||
class InrocksTvPage(GenericNewsPage):
|
class InrocksTvPage(GenericNewsPage):
|
||||||
"ArticlePage object for inrocks"
|
"ArticlePage object for inrocks"
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def id2url(_id):
|
def id2url(_id):
|
||||||
"return an url from an id"
|
"return an url from an id"
|
||||||
regexp2 = re.compile("(\w+).([0-9]+).(.*$)")
|
regexp2 = re.compile("(\w+).([0-9]+).(.*$)")
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,12 @@ class IpinfodbBackend(BaseBackend, ICapGeolocIp):
|
||||||
if 'Invalid IP or domain name' in content:
|
if 'Invalid IP or domain name' in content:
|
||||||
raise Exception('Bad parameter')
|
raise Exception('Bad parameter')
|
||||||
else:
|
else:
|
||||||
tab = {'City' : 'NA' ,\
|
tab = {'City' : 'NA' ,
|
||||||
'Country name' : 'NA' ,\
|
'Country name' : 'NA' ,
|
||||||
'Region' : 'NA' ,\
|
'Region' : 'NA' ,
|
||||||
'Latitude' : 'NA' ,\
|
'Latitude' : 'NA' ,
|
||||||
'Longitude' : 'NA' ,\
|
'Longitude' : 'NA' ,
|
||||||
'hostname' : 'NA' ,\
|
'hostname' : 'NA' ,
|
||||||
'zipcode' : 'NA'}
|
'zipcode' : 'NA'}
|
||||||
line = ''
|
line = ''
|
||||||
for line in content.split('\n'):
|
for line in content.split('\n'):
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class IpinfodbTest(BackendTest):
|
class IpinfodbTest(BackendTest):
|
||||||
BACKEND = 'ipinfodb'
|
BACKEND = 'ipinfodb'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
class IsohuntTest(BackendTest):
|
class IsohuntTest(BackendTest):
|
||||||
BACKEND = 'isohunt'
|
BACKEND = 'isohunt'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class TorrentPage(BasePage):
|
||||||
for span in self.document.getiterator('span'):
|
for span in self.document.getiterator('span'):
|
||||||
# sometimes there are others span, this is not so sure but the size of the children list
|
# sometimes there are others span, this is not so sure but the size of the children list
|
||||||
# is enough to know if this is the right span
|
# is enough to know if this is the right span
|
||||||
if (span.attrib.get('class', '') == 'folder' \
|
if (span.attrib.get('class', '') == 'folder'
|
||||||
or span.attrib.get('class', '') == 'folderopen') \
|
or span.attrib.get('class', '') == 'folderopen') \
|
||||||
and len(span.getchildren()) > 2:
|
and len(span.getchildren()) > 2:
|
||||||
size = span.getchildren()[1].tail
|
size = span.getchildren()[1].tail
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from weboob.capabilities.base import NotLoaded
|
||||||
import urllib
|
import urllib
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
class KickassTest(BackendTest):
|
class KickassTest(BackendTest):
|
||||||
BACKEND = 'kickass'
|
BACKEND = 'kickass'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class LCLBrowser(BaseBrowser):
|
||||||
assert self.agency.isdigit()
|
assert self.agency.isdigit()
|
||||||
|
|
||||||
if not self.is_on_page(LoginPage):
|
if not self.is_on_page(LoginPage):
|
||||||
self.location('%s://%s/outil/UAUT/Authentication/authenticate' \
|
self.location('%s://%s/outil/UAUT/Authentication/authenticate'
|
||||||
% (self.PROTOCOL, self.DOMAIN),
|
% (self.PROTOCOL, self.DOMAIN),
|
||||||
no_login=True)
|
no_login=True)
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ class LCLBrowser(BaseBrowser):
|
||||||
not self.is_logged() or \
|
not self.is_logged() or \
|
||||||
(self.is_on_page(LoginPage) and self.page.is_error()) :
|
(self.is_on_page(LoginPage) and self.page.is_error()) :
|
||||||
raise BrowserIncorrectPassword("invalid login/password.\nIf you did not change anything, be sure to check for password renewal request\non the original web site.\nAutomatic renewal will be implemented later.")
|
raise BrowserIncorrectPassword("invalid login/password.\nIf you did not change anything, be sure to check for password renewal request\non the original web site.\nAutomatic renewal will be implemented later.")
|
||||||
self.location('%s://%s/outil/UWSP/Synthese' \
|
self.location('%s://%s/outil/UWSP/Synthese'
|
||||||
% (self.PROTOCOL, self.DOMAIN),
|
% (self.PROTOCOL, self.DOMAIN),
|
||||||
no_login=True)
|
no_login=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ class ContractsPage(BasePage):
|
||||||
self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'mainForm')
|
self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'mainForm')
|
||||||
self.browser.submit()
|
self.browser.submit()
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
warn = self.document.xpath('//div[@id="attTxt"]')
|
warn = self.document.xpath('//div[@id="attTxt"]')
|
||||||
|
|
@ -222,6 +223,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^(?P<category>REM CHQ) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^(?P<category>REM CHQ) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistoryPage(BasePage):
|
class AccountHistoryPage(BasePage):
|
||||||
def get_table(self):
|
def get_table(self):
|
||||||
tables=self.document.findall("//table[@class='tagTab pyjama']")
|
tables=self.document.findall("//table[@class='tagTab pyjama']")
|
||||||
|
|
@ -303,6 +305,7 @@ class AccountHistoryPage(BasePage):
|
||||||
operations.append(operation)
|
operations.append(operation)
|
||||||
return operations
|
return operations
|
||||||
|
|
||||||
|
|
||||||
class CBHistoryPage(AccountHistoryPage):
|
class CBHistoryPage(AccountHistoryPage):
|
||||||
def get_table(self):
|
def get_table(self):
|
||||||
# there is only one table on the page
|
# there is only one table on the page
|
||||||
|
|
@ -320,6 +323,7 @@ class CBHistoryPage(AccountHistoryPage):
|
||||||
tr.type = tr.TYPE_CARD
|
tr.type = tr.TYPE_CARD
|
||||||
yield tr
|
yield tr
|
||||||
|
|
||||||
|
|
||||||
class CBListPage(CBHistoryPage):
|
class CBListPage(CBHistoryPage):
|
||||||
def get_cards(self):
|
def get_cards(self):
|
||||||
cards = []
|
cards = []
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue