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'
|
||||
STORAGE_FILE = 'boobot.storage'
|
||||
|
||||
|
||||
class MyThread(Thread):
|
||||
def __init__(self, bot):
|
||||
Thread.__init__(self)
|
||||
|
|
@ -50,9 +51,9 @@ class MyThread(Thread):
|
|||
self.weboob.loop()
|
||||
|
||||
def find_keywords(self, text):
|
||||
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg', \
|
||||
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob', \
|
||||
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs', \
|
||||
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg',
|
||||
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob',
|
||||
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs',
|
||||
'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']:
|
||||
if word in text.lower():
|
||||
return word
|
||||
|
|
@ -80,6 +81,7 @@ class MyThread(Thread):
|
|||
def stop(self):
|
||||
self.weboob.want_stop()
|
||||
|
||||
|
||||
class TestBot(SingleServerIRCBot):
|
||||
def __init__(self, channel, nickname, server, port=6667):
|
||||
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`")
|
||||
|
|
@ -121,6 +123,7 @@ class TestBot(SingleServerIRCBot):
|
|||
if h:
|
||||
self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency))
|
||||
|
||||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER)
|
||||
|
|
|
|||
|
|
@ -39,14 +39,18 @@ if sys.stdout.encoding is None:
|
|||
|
||||
# end of hack
|
||||
|
||||
|
||||
def removeNonAscii(s): return "".join(i for i in s if ord(i)<128)
|
||||
|
||||
rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE)
|
||||
|
||||
|
||||
def removeSpecial(s):
|
||||
return rx.sub(u' ', u'%s' % s)
|
||||
|
||||
DOWNLOAD_DIRECTORY=".files"
|
||||
|
||||
|
||||
class Downloadboob:
|
||||
|
||||
def __init__(self, backend_name, download_directory, links_directory):
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class VideoobWeb(BaseApplication):
|
|||
page_url=video.page_url,
|
||||
url=video.url if video.url else '/download?id=%s' % video.id,
|
||||
thumbnail_url=video.thumbnail.url,
|
||||
) \
|
||||
)
|
||||
for video in backend.search_videos(pattern=q, nsfw=nsfw)]
|
||||
if videos:
|
||||
if merge:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from __future__ import with_statement
|
|||
|
||||
import os
|
||||
|
||||
|
||||
def genapi():
|
||||
os.system('rm -rf api')
|
||||
os.system('mkdir api')
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class IndexPage(BasePage):
|
|||
|
||||
yield video
|
||||
|
||||
|
||||
class VideoPage(BasePage):
|
||||
def get_video(self, video=None, lang='fr', quality='hd'):
|
||||
if not video:
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class SubtitlesPage(BasePage):
|
|||
traduced_title_words = traduced_title.split()
|
||||
original_title_words = original_title.split()
|
||||
|
||||
# if the pattern is one word and in the title OR if the
|
||||
# if the pattern is one word and in the title OR if the
|
||||
# intersection between pattern and the title is at least 2 words
|
||||
if (len(pattern_words) == 1 and pattern in traduced_title_words) or\
|
||||
(len(pattern_words) == 1 and pattern in original_title_words) or\
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from weboob.tools.test import BackendTest
|
|||
import urllib
|
||||
from random import choice
|
||||
|
||||
|
||||
class AttilasubTest(BackendTest):
|
||||
BACKEND = 'attilasub'
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ def parse_dt(s):
|
|||
d = _parse_dt(s)
|
||||
return local2utc(d)
|
||||
|
||||
|
||||
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount):
|
||||
NAME = 'aum'
|
||||
MAINTAINER = u'Romain Bignon'
|
||||
|
|
@ -503,6 +504,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
|||
browser = None
|
||||
|
||||
REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'')
|
||||
|
||||
def confirm_account(self, mail):
|
||||
msg = email.message_from_string(mail)
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class AuMException(UserError):
|
|||
Exception.__init__(self, self.ERRORS.get(code, code))
|
||||
self.code = code
|
||||
|
||||
|
||||
class AuMBrowser(BaseBrowser):
|
||||
DOMAIN = 'www.adopteunmec.com'
|
||||
APIKEY = 'fb0123456789abcd'
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@ try:
|
|||
except ImportError:
|
||||
raise ImportError('Please install python-imaging')
|
||||
|
||||
|
||||
class CaptchaError(Exception): pass
|
||||
|
||||
|
||||
class Tile(object):
|
||||
hash = {
|
||||
'bc8d52d96058478a6def26226145d53b': 'A',
|
||||
|
|
@ -115,6 +117,7 @@ class Tile(object):
|
|||
print 'hash: %s' % checksum
|
||||
raise CaptchaError()
|
||||
|
||||
|
||||
class Captcha(object):
|
||||
def __init__(self, f):
|
||||
self.img = Image.open(f)
|
||||
|
|
@ -156,6 +159,7 @@ class Captcha(object):
|
|||
s += tile.letter
|
||||
return s
|
||||
|
||||
|
||||
class Decoder(object):
|
||||
def __init__(self):
|
||||
self.hash = {}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ class FieldConst(FieldBase):
|
|||
labels.append(consts[self.key][i])
|
||||
return labels
|
||||
|
||||
|
||||
class Contact(_Contact):
|
||||
TABLE = OrderedDict((
|
||||
('_info', OrderedDict((
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class UnavailablePage(BasePage):
|
|||
def on_loaded(self):
|
||||
raise BrowserUnavailable()
|
||||
|
||||
|
||||
class VirtKeyboard(MappedVirtKeyboard):
|
||||
symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3',
|
||||
'1':'3495abaf658dc550e51c5c92ea56b60b',
|
||||
|
|
@ -148,6 +149,7 @@ class AccountsPage(BasePage):
|
|||
account._args = args
|
||||
yield account
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^RET(RAIT) DAB (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class AXABanqueTest(BackendTest):
|
||||
BACKEND = 'axabanque'
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class UnavailablePage(BasePage):
|
|||
else:
|
||||
self.browser.location(a.attrib['href'])
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
self.browser.select_form(name='Login')
|
||||
|
|
@ -46,6 +47,7 @@ class LoginPage(BasePage):
|
|||
self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING)
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class IndexPage(BasePage):
|
||||
def get_token(self):
|
||||
url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src']
|
||||
|
|
@ -53,6 +55,7 @@ class IndexPage(BasePage):
|
|||
args = dict(parse_qsl(v.query))
|
||||
return args['token']
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS,
|
||||
u'Mes comptes': Account.TYPE_CHECKING,
|
||||
|
|
@ -101,6 +104,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
return
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^RET DAB (?P<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class BanquePopulaireTest(BackendTest):
|
||||
BACKEND = 'banquepopulaire'
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class LoginPage(BasePage):
|
|||
else:
|
||||
return True
|
||||
|
||||
|
||||
class Login2Page(BasePage):
|
||||
def login(self, secret):
|
||||
label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip()
|
||||
|
|
@ -55,9 +56,11 @@ class Login2Page(BasePage):
|
|||
self.browser['word'] = letters
|
||||
self.browser.submit(name='valider', nologin=True)
|
||||
|
||||
|
||||
class IndexPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS,
|
||||
u'Liquidités': Account.TYPE_CHECKING,
|
||||
|
|
@ -170,11 +173,13 @@ class Transaction(FrenchTransaction):
|
|||
FrenchTransaction.TYPE_UNKNOWN),
|
||||
]
|
||||
|
||||
|
||||
class HistoryBasePage(BasePage):
|
||||
def get_history(self):
|
||||
self.logger.warning('Do not support account of type %s' % type(self).__name__)
|
||||
return iter([])
|
||||
|
||||
|
||||
class TransactionsPage(HistoryBasePage):
|
||||
def get_history(self):
|
||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||
|
|
@ -229,11 +234,14 @@ class CardPage(HistoryBasePage):
|
|||
t.set_amount(amount)
|
||||
yield t
|
||||
|
||||
|
||||
class ValuationPage(HistoryBasePage):
|
||||
pass
|
||||
|
||||
|
||||
class LoanPage(HistoryBasePage):
|
||||
pass
|
||||
|
||||
|
||||
class MarketPage(HistoryBasePage):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class BarclaysTest(BackendTest):
|
||||
BACKEND = 'barclays'
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard,VirtKeyboardErr
|
|||
|
||||
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
||||
|
||||
|
||||
class BNPVirtKeyboard(MappedVirtKeyboard):
|
||||
symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5',
|
||||
'1':'e10b58fc085f9683052d5a63c96fc912',
|
||||
|
|
@ -100,10 +101,12 @@ class ConfirmPage(BasePage):
|
|||
if m:
|
||||
return m.group(1)
|
||||
|
||||
|
||||
class InfoMessagePage(BasePage):
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
||||
|
||||
class ChangePasswordPage(BasePage):
|
||||
def change_password(self, current, new):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class Transaction(FrenchTransaction):
|
|||
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
]
|
||||
|
||||
|
||||
class AccountHistory(BasePage):
|
||||
def iter_operations(self):
|
||||
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class Account(object):
|
|||
self.send_checkbox = send_checkbox
|
||||
self.receive_checkbox = receive_checkbox
|
||||
|
||||
|
||||
class TransferPage(BasePage):
|
||||
def on_loaded(self):
|
||||
for td in self.document.xpath('//td[@class="hdvon1"]'):
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class ProAccountsList(BasePage):
|
|||
COL_ID = 2
|
||||
COL_BALANCE = 3
|
||||
COL_COMING = 5
|
||||
|
||||
def get_list(self):
|
||||
for tr in self.document.xpath('//tr[@class="comptes"]'):
|
||||
cols = tr.findall('td')
|
||||
|
|
@ -57,6 +58,7 @@ class ProAccountsList(BasePage):
|
|||
|
||||
yield account
|
||||
|
||||
|
||||
class ProAccountHistory(BasePage):
|
||||
COL_DATE = 0
|
||||
COL_LABEL = 1
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from .account_history import AccountHistory
|
|||
from .accounts_list import AccountsList
|
||||
from .login import LoginPage, UpdateInfoPage
|
||||
|
||||
|
||||
class AccountPrelevement(AccountsList):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
|||
|
||||
__all__ = ['AccountHistory']
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
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>.*)'),
|
||||
|
|
@ -42,6 +43,7 @@ class Transaction(FrenchTransaction):
|
|||
(re.compile('^REM CHQ (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
]
|
||||
|
||||
|
||||
class AccountHistory(BasePage):
|
||||
|
||||
def on_loaded(self):
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class VirtKeyboard(MappedVirtKeyboard):
|
|||
s += " "
|
||||
return hashlib.md5(s).hexdigest()
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
|
@ -98,6 +99,7 @@ class LoginPage(BasePage):
|
|||
|
||||
self.browser.location(form.attrib['action'], urllib.urlencode(args), no_login=True)
|
||||
|
||||
|
||||
class UpdateInfoPage(BasePage):
|
||||
def on_loaded(self):
|
||||
raise BrowserIncorrectPassword('Please update your user informations')
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class BoursoramaTest(BackendTest):
|
||||
BACKEND = 'boursorama'
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class BouyguesTest(BackendTest):
|
||||
BACKEND = 'bouygues'
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class Transaction(FrenchTransaction):
|
|||
(re.compile('^(?P<category>REMISE DE CHEQUE) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
]
|
||||
|
||||
|
||||
class AccountHistory(BasePage):
|
||||
def get_next_link(self):
|
||||
for a in self.document.xpath('//a[@class="btn_crt"]'):
|
||||
|
|
@ -105,6 +106,7 @@ class AccountHistory(BasePage):
|
|||
operations.append(op)
|
||||
return operations
|
||||
|
||||
|
||||
class CardsList(BasePage):
|
||||
def get_cards(self):
|
||||
cards = []
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ def md5(f):
|
|||
md5.update(f.read())
|
||||
return md5.hexdigest()
|
||||
|
||||
|
||||
class UnavailablePage(BasePage):
|
||||
def on_loaded(self):
|
||||
raise BrowserUnavailable()
|
||||
|
|
@ -57,14 +58,17 @@ class LoginPage(BasePage):
|
|||
self.browser['username'] = login
|
||||
self.browser.submit()
|
||||
|
||||
|
||||
class repositionnerCheminCourant(BasePage):
|
||||
def on_loaded(self):
|
||||
self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/initialiser-identif.ea")
|
||||
|
||||
|
||||
class Initident(BasePage):
|
||||
def on_loaded(self):
|
||||
self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/verifierMotDePasse-identif.ea")
|
||||
|
||||
|
||||
class CheckPassword(BasePage):
|
||||
def on_loaded(self):
|
||||
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.submit(nologin=True)
|
||||
|
||||
|
||||
class LoginResultPage(BasePage):
|
||||
def confirm(self):
|
||||
self.browser.location('MainAuth?typeDemande=AC', no_login=True)
|
||||
|
|
@ -52,9 +53,11 @@ class LoginResultPage(BasePage):
|
|||
|
||||
return error.text.strip()
|
||||
|
||||
|
||||
class EmptyPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class BredBasePage(BasePage):
|
||||
def js2args(self, s):
|
||||
cur_arg = None
|
||||
|
|
@ -70,6 +73,7 @@ class BredBasePage(BasePage):
|
|||
|
||||
return args
|
||||
|
||||
|
||||
class AccountsPage(BredBasePage):
|
||||
def get_list(self):
|
||||
accounts = []
|
||||
|
|
@ -123,6 +127,7 @@ class AccountsPage(BredBasePage):
|
|||
|
||||
return accounts
|
||||
|
||||
|
||||
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}).*'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class BredTest(BackendTest):
|
||||
BACKEND = 'bred'
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ class TorrentsPage(BasePage):
|
|||
torrent.description = NotLoaded
|
||||
torrent.files = NotLoaded
|
||||
yield torrent
|
||||
|
||||
|
||||
|
||||
class TorrentPage(BasePage):
|
||||
|
|
@ -86,7 +85,7 @@ class TorrentPage(BasePage):
|
|||
href_t = self.parser.select(div,'a.down',1).attrib.get('href','')
|
||||
url = u'http://%s%s'%(self.browser.DOMAIN,href_t)
|
||||
magnet = unicode(self.parser.select(div,'a.magnet',1).attrib.get('href',''))
|
||||
|
||||
|
||||
divtabs = self.parser.select(div,'div#tabs',1)
|
||||
files_div = self.parser.select(divtabs,'div.body > div.doubleblock > div.leftblock')
|
||||
files = []
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from weboob.capabilities.base import NotLoaded
|
|||
|
||||
from random import choice
|
||||
|
||||
|
||||
class BtmonTest(BackendTest):
|
||||
BACKEND = 'btmon'
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class LoginPage(BasePage):
|
|||
self.browser.form.action = m.group(1)
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class ErrorPage(BasePage):
|
||||
def get_error(self):
|
||||
try:
|
||||
|
|
@ -61,6 +62,7 @@ class ErrorPage(BasePage):
|
|||
except BrokenPageError:
|
||||
return None
|
||||
|
||||
|
||||
class UnavailablePage(BasePage):
|
||||
def on_loaded(self):
|
||||
try:
|
||||
|
|
@ -68,6 +70,7 @@ class UnavailablePage(BasePage):
|
|||
except BrokenPageError:
|
||||
raise BrowserUnavailable()
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^CB (?P<text>.*?) FACT (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d{2})'),
|
||||
FrenchTransaction.TYPE_CARD),
|
||||
|
|
@ -87,6 +90,7 @@ class Transaction(FrenchTransaction):
|
|||
(re.compile('^CB [\d\*]+ (?P<text>.*)'), FrenchTransaction.TYPE_CARD),
|
||||
]
|
||||
|
||||
|
||||
class IndexPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'Epargne liquide': Account.TYPE_SAVINGS,
|
||||
u'Compte Courant': Account.TYPE_CHECKING,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CaisseEpargneTest(BackendTest):
|
||||
BACKEND = 'caissedepargne'
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
from weboob.tools.test import BackendTest
|
||||
from weboob.capabilities.video import BaseVideo
|
||||
|
||||
|
||||
class CanalPlusTest(BackendTest):
|
||||
BACKEND = 'canalplus'
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CanalTPTest(BackendTest):
|
||||
BACKEND = 'canaltp'
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,11 @@ class LoginPage(BasePage):
|
|||
except FormNotFoundError:
|
||||
raise BrowserIncorrectPassword()
|
||||
|
||||
|
||||
class HomePage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
def get_list(self):
|
||||
div = self.document.xpath('//div[@id="descriptifdroite"]')[0]
|
||||
|
|
@ -73,6 +75,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
yield account
|
||||
|
||||
|
||||
class TransactionsPage(BasePage):
|
||||
COL_DATE = 0
|
||||
COL_TEXT = 1
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CarrefourBanqueTest(BackendTest):
|
||||
BACKEND = 'carrefourbanque'
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from weboob.tools.ordereddict import OrderedDict
|
|||
from weboob.capabilities.bank import Account
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
self.browser.select_form(name='ident')
|
||||
|
|
@ -35,25 +36,32 @@ class LoginPage(BasePage):
|
|||
self.browser['_cm_pwd'] = passwd
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class LoginErrorPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class ChangePasswordPage(BasePage):
|
||||
def on_loaded(self):
|
||||
raise BrowserIncorrectPassword('Please change your password')
|
||||
|
||||
|
||||
class InfoPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class EmptyPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class TransfertPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class UserSpacePage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
def get_list(self):
|
||||
accounts = OrderedDict()
|
||||
|
|
@ -102,6 +110,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
return accounts.itervalues()
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||
|
|
@ -116,6 +125,7 @@ class Transaction(FrenchTransaction):
|
|||
|
||||
_is_coming = False
|
||||
|
||||
|
||||
class OperationsPage(BasePage):
|
||||
def get_history(self):
|
||||
index = 0
|
||||
|
|
@ -181,6 +191,7 @@ class OperationsPage(BasePage):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
class CardPage(OperationsPage):
|
||||
def get_history(self):
|
||||
index = 0
|
||||
|
|
@ -200,6 +211,7 @@ class CardPage(OperationsPage):
|
|||
tr.set_amount(tds[-1].text)
|
||||
yield tr
|
||||
|
||||
|
||||
class NoOperationsPage(OperationsPage):
|
||||
def get_history(self):
|
||||
return iter([])
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CICTest(BackendTest):
|
||||
BACKEND = 'cic'
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ __all__ = ['HTTPSVerifiedConnection', 'HellHTTPS']
|
|||
|
||||
PROXY_PORT = 8080
|
||||
|
||||
|
||||
class HTTPSVerifiedConnection(httplib.HTTPSConnection):
|
||||
"""
|
||||
This class allows communication via SSL, and will checks certificates
|
||||
|
|
@ -54,7 +55,7 @@ class HTTPSVerifiedConnection(httplib.HTTPSConnection):
|
|||
if self._tunnel_host:
|
||||
self.sock = sock
|
||||
self._tunnel()
|
||||
|
||||
|
||||
if self.ca_file:
|
||||
self.sock = ssl.wrap_socket(sock,
|
||||
self.key_file,
|
||||
|
|
@ -102,7 +103,7 @@ class HellHTTPS:
|
|||
else:
|
||||
self.conn = HTTPSVerifiedConnection(host, port, key_file, cert_file,
|
||||
ca_file, strict, timeout, callBack)
|
||||
|
||||
|
||||
def request(self, *args, **kwargs):
|
||||
self.conn.request(*args, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
|||
self.browser['motDePasse'] = passwd.encode(self.browser.ENCODING)
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
def get_list(self):
|
||||
names = set()
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CmsoTest(BackendTest):
|
||||
BACKEND = 'cmso'
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import mechanize
|
|||
from datetime import datetime
|
||||
import re
|
||||
|
||||
|
||||
class Cragr(BaseBrowser):
|
||||
PROTOCOL = 'https'
|
||||
ENCODING = 'utf-8'
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from .base import CragrBasePage
|
|||
from .tokenextractor import TokenExtractor
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [
|
||||
(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),
|
||||
]
|
||||
|
||||
|
||||
class AccountsList(CragrBasePage):
|
||||
"""
|
||||
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 BrowserUnavailable
|
||||
|
||||
|
||||
class CragrBasePage(BasePage):
|
||||
def on_loaded(self):
|
||||
# Check for an error
|
||||
|
|
|
|||
|
|
@ -17,16 +17,19 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
class TokenExtractor:
|
||||
""" Extracts texts token from an HTML document """
|
||||
def __init__(self):
|
||||
self.iterated_elements = []
|
||||
|
||||
def clear(self):
|
||||
"""
|
||||
Reset any content stored within a TokenExtractor object. Useful to start
|
||||
a new parsing without creating a new instance.
|
||||
"""
|
||||
self.iterated_elements = []
|
||||
|
||||
def element_iterated_already(self, html_element):
|
||||
if html_element in self.iterated_elements:
|
||||
return True
|
||||
|
|
@ -34,6 +37,7 @@ class TokenExtractor:
|
|||
if ancestor in self.iterated_elements:
|
||||
return True
|
||||
return False
|
||||
|
||||
def extract_tokens(self, html_element):
|
||||
if self.element_iterated_already(html_element):
|
||||
return
|
||||
|
|
@ -44,10 +48,12 @@ class TokenExtractor:
|
|||
for token in self.split_text_into_smaller_tokens(text):
|
||||
if self.token_looks_relevant(token):
|
||||
yield token.strip()
|
||||
|
||||
@staticmethod
|
||||
def split_text_into_smaller_tokens(text):
|
||||
for subtext1 in text.split('\t'):
|
||||
yield subtext1
|
||||
|
||||
@staticmethod
|
||||
def token_looks_relevant(token):
|
||||
return len(token.strip()) > 1
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CrAgrTest(BackendTest):
|
||||
BACKEND = 'cragr'
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
|||
self.browser['j_password'] = password.encode('iso-8859-15')
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class LoggedPage(BasePage):
|
||||
def get_error(self):
|
||||
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')])
|
||||
return re.sub('[\r\n\t\xa0]+', ' ', msg)
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
||||
|
||||
|
|
@ -65,6 +67,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
yield account
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^(?P<text>RETRAIT DAB) (?P<dd>\d{2})-(?P<mm>\d{2})-([\d\-]+)'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
@ -88,9 +91,11 @@ class Transaction(FrenchTransaction):
|
|||
FrenchTransaction.TYPE_UNKNOWN),
|
||||
]
|
||||
|
||||
|
||||
class TransactionsPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class TransactionsJSONPage(BasePage):
|
||||
ROW_DATE = 0
|
||||
ROW_TEXT = 2
|
||||
|
|
@ -104,6 +109,7 @@ class TransactionsJSONPage(BasePage):
|
|||
t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT])
|
||||
yield t
|
||||
|
||||
|
||||
class ComingTransactionsPage(BasePage):
|
||||
ROW_REF = 0
|
||||
ROW_TEXT = 1
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
|||
|
||||
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage']
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, pin, strong_auth):
|
||||
form_nb = 1 if strong_auth else 0
|
||||
|
|
@ -41,6 +42,7 @@ class LoginPage(BasePage):
|
|||
assert self.browser['identType'] == indentType
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING}
|
||||
|
||||
|
|
@ -77,6 +79,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
return
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^RETRAIT DAB (?P<text>.*?).*'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
@ -95,6 +98,7 @@ class Transaction(FrenchTransaction):
|
|||
FrenchTransaction.TYPE_UNKNOWN),
|
||||
]
|
||||
|
||||
|
||||
class TransactionsPage(BasePage):
|
||||
def get_next_url(self):
|
||||
# can be 'Suivant' or ' Suivant'
|
||||
|
|
@ -109,6 +113,7 @@ class TransactionsPage(BasePage):
|
|||
TR_TEXT = 2
|
||||
TR_DEBIT = 3
|
||||
TR_CREDIT = 4
|
||||
|
||||
def get_history(self):
|
||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||
tds = tr.findall('td')
|
||||
|
|
@ -129,6 +134,7 @@ class TransactionsPage(BasePage):
|
|||
|
||||
yield t
|
||||
|
||||
|
||||
class ComingTransactionsPage(BasePage):
|
||||
COM_TR_COMMENT = 0
|
||||
COM_TR_DATE = 1
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CreditCooperatifTest(BackendTest):
|
||||
BACKEND = 'creditcooperatif'
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ __all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage']
|
|||
class LoginPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class CDNBasePage(BasePage):
|
||||
def get_from_js(self, pattern, end, is_list=False):
|
||||
"""
|
||||
|
|
@ -69,6 +70,7 @@ class CDNBasePage(BasePage):
|
|||
def get_execution(self):
|
||||
return self.get_from_js("name: 'execution', value: '", "'")
|
||||
|
||||
|
||||
class AccountsPage(CDNBasePage):
|
||||
COL_HISTORY = 2
|
||||
COL_ID = 4
|
||||
|
|
@ -113,6 +115,7 @@ class AccountsPage(CDNBasePage):
|
|||
|
||||
return iter(accounts)
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile(r'^(?P<text>RET DAB \w+ .*?) LE (?P<dd>\d{2})(?P<mm>\d{2})$'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CreditDuNordTest(BackendTest):
|
||||
BACKEND = 'creditdunord'
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from weboob.tools.ordereddict import OrderedDict
|
|||
from weboob.capabilities.bank import Account
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
self.browser.select_form(nr=0)
|
||||
|
|
@ -35,25 +36,32 @@ class LoginPage(BasePage):
|
|||
self.browser['_cm_pwd'] = passwd
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class LoginErrorPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class ChangePasswordPage(BasePage):
|
||||
def on_loaded(self):
|
||||
raise BrowserIncorrectPassword('Please change your password')
|
||||
|
||||
|
||||
class InfoPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class EmptyPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class TransfertPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class UserSpacePage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
def get_list(self):
|
||||
accounts = OrderedDict()
|
||||
|
|
@ -102,6 +110,7 @@ class AccountsPage(BasePage):
|
|||
|
||||
return accounts.itervalues()
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||
|
|
@ -116,6 +125,7 @@ class Transaction(FrenchTransaction):
|
|||
|
||||
_is_coming = False
|
||||
|
||||
|
||||
class OperationsPage(BasePage):
|
||||
def get_history(self):
|
||||
index = 0
|
||||
|
|
@ -181,6 +191,7 @@ class OperationsPage(BasePage):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
class CardPage(OperationsPage):
|
||||
def get_history(self):
|
||||
index = 0
|
||||
|
|
@ -200,6 +211,7 @@ class CardPage(OperationsPage):
|
|||
tr.set_amount(tds[-1].text)
|
||||
yield tr
|
||||
|
||||
|
||||
class NoOperationsPage(OperationsPage):
|
||||
def get_history(self):
|
||||
return iter([])
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class CreditMutuelTest(BackendTest):
|
||||
BACKEND = 'creditmutuel'
|
||||
|
||||
|
|
@ -28,5 +29,3 @@ class CreditMutuelTest(BackendTest):
|
|||
if len(l) > 0:
|
||||
a = l[0]
|
||||
list(self.backend.iter_history(a))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class DailymotionBackend(BaseBackend, ICapVideo, ICapCollection):
|
|||
return self.browser.get_video(_id)
|
||||
|
||||
SORTBY = ['relevance', 'rated', 'visited', None]
|
||||
|
||||
def search_videos(self, pattern, sortby=ICapVideo.SEARCH_RELEVANCE, nsfw=False, max_results=None):
|
||||
with self.browser:
|
||||
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'])
|
||||
return 0
|
||||
|
||||
|
||||
class VideoPage(BasePage):
|
||||
def get_video(self, video=None):
|
||||
if video is None:
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent):
|
|||
date=com.date,
|
||||
parent=parent,
|
||||
content=com.body,
|
||||
signature=com.signature + \
|
||||
signature=com.signature +
|
||||
'<br />'.join(['Score: %d' % com.score,
|
||||
'URL: %s' % com.url]),
|
||||
children=[],
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ from .pages.wiki import WikiEditPage
|
|||
from .tools import id2url, url2id
|
||||
|
||||
# Browser
|
||||
|
||||
|
||||
class DLFP(BaseBrowser):
|
||||
DOMAIN = 'linuxfr.org'
|
||||
PROTOCOL = 'https'
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ from logging import warning
|
|||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
||||
class Message(object):
|
||||
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):
|
||||
self.id = id
|
||||
self.timestamp = timestamp
|
||||
|
|
@ -40,6 +42,7 @@ class Message(object):
|
|||
else:
|
||||
warning('Unable to parse timestamp "%s"' % timestamp)
|
||||
|
||||
|
||||
class BoardIndexPage(BasePage):
|
||||
def is_logged(self):
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
||||
class DLFPPage(BasePage):
|
||||
def is_logged(self):
|
||||
for form in self.document.getiterator('form'):
|
||||
|
|
@ -28,6 +29,7 @@ class DLFPPage(BasePage):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
class IndexPage(DLFPPage):
|
||||
def get_login_token(self):
|
||||
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':
|
||||
return i.attrib['value']
|
||||
|
||||
|
||||
class LoginPage(DLFPPage):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ from ..tools import url2id
|
|||
|
||||
from .index import DLFPPage
|
||||
|
||||
|
||||
class RSSComment(DLFPPage):
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
||||
|
||||
class Content(object):
|
||||
TAGGABLE = False
|
||||
|
||||
|
|
@ -50,6 +52,7 @@ class Content(object):
|
|||
def is_taggable(self):
|
||||
return False
|
||||
|
||||
|
||||
class Comment(Content):
|
||||
def __init__(self, article, div, reply_id):
|
||||
Content.__init__(self, article.browser)
|
||||
|
|
@ -105,6 +108,7 @@ class Comment(Content):
|
|||
def __repr__(self):
|
||||
return u"<Comment id=%r author=%r title=%r>" % (self.id, self.author, self.title)
|
||||
|
||||
|
||||
class Article(Content):
|
||||
TAGGABLE = True
|
||||
|
||||
|
|
@ -149,11 +153,13 @@ class Article(Content):
|
|||
for c in comment.iter_all_comments():
|
||||
yield c
|
||||
|
||||
|
||||
class CommentPage(DLFPPage):
|
||||
def get_comment(self):
|
||||
article = Article(self.browser, self.url, None)
|
||||
return Comment(article, self.parser.select(self.document.getroot(), 'li.comment', 1), 0)
|
||||
|
||||
|
||||
class ContentPage(DLFPPage):
|
||||
def on_loaded(self):
|
||||
self.article = None
|
||||
|
|
@ -192,9 +198,11 @@ class ContentPage(DLFPPage):
|
|||
def get_tag_url(self):
|
||||
return self.parser.select(self.document.getroot(), 'div.tag_in_place', 1).find('a').attrib['href']
|
||||
|
||||
|
||||
class NewCommentPage(DLFPPage):
|
||||
pass
|
||||
|
||||
|
||||
class NewTagPage(DLFPPage):
|
||||
def _is_tag_form(self, form):
|
||||
return form.action.endswith('/tags')
|
||||
|
|
@ -204,6 +212,7 @@ class NewTagPage(DLFPPage):
|
|||
self.browser['tags'] = tag
|
||||
self.browser.submit()
|
||||
|
||||
|
||||
class NodePage(DLFPPage):
|
||||
def get_errors(self):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ from weboob.tools.browser import BrokenPageError
|
|||
|
||||
from .index import DLFPPage
|
||||
|
||||
|
||||
class WikiEditPage(DLFPPage):
|
||||
def get_body(self):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ REGEXPS = {'/users/%s/journaux/%s': 'D%s.%s',
|
|||
'/forums/%s/posts/%s': 'B%s.%s',
|
||||
}
|
||||
|
||||
|
||||
def f2re(f):
|
||||
return '.*' + f.replace('%s', '([^ /]+)')
|
||||
|
||||
|
||||
def rssid(entry):
|
||||
m = RSSID_RE.match(entry.id)
|
||||
if not m:
|
||||
|
|
@ -53,6 +55,7 @@ def rssid(entry):
|
|||
else:
|
||||
return '%s.%s' % (ind, m.group(2))
|
||||
|
||||
|
||||
def id2url(id):
|
||||
m = ID2URL_RE.match(id)
|
||||
if not m:
|
||||
|
|
@ -67,6 +70,7 @@ def id2url(id):
|
|||
else:
|
||||
return url_re % m.group(3)
|
||||
|
||||
|
||||
def url2id(url):
|
||||
for url_re, id_re in REGEXPS.iteritems():
|
||||
m = re.match(f2re(url_re), url)
|
||||
|
|
@ -75,6 +79,7 @@ def url2id(url):
|
|||
|
||||
return id_re % m.groups()
|
||||
|
||||
|
||||
def id2threadid(id):
|
||||
m = ID2URL_RE.match(id)
|
||||
if m:
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ __all__ = ['StartPage']
|
|||
|
||||
|
||||
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"]
|
||||
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])
|
||||
if i == 3:
|
||||
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])
|
||||
if i == 4:
|
||||
text = paraph.xpath('b/font[@size="4"]/span')[0].text
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class EHentaiBackend(BaseBackend, ICapGallery, ICapCollection):
|
|||
|
||||
ID_REGEXP = r'/?\d+/[\dabcdef]+/?'
|
||||
URL_REGEXP = r'.+/g/(%s)' % ID_REGEXP
|
||||
|
||||
def get_gallery(self, _id):
|
||||
match = re.match(r'^%s$' % self.URL_REGEXP, _id)
|
||||
if match:
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ from weboob.capabilities.gallery import BaseGallery, BaseImage
|
|||
|
||||
__all_ = ['EHentaiGallery', 'EHentaiImage']
|
||||
|
||||
|
||||
class EHentaiGallery(BaseGallery):
|
||||
def __init__(self, *args, **kwargs):
|
||||
BaseGallery.__init__(self, *args, **kwargs)
|
||||
|
||||
|
||||
class EHentaiImage(BaseImage):
|
||||
def __init__(self, *args, **kwargs):
|
||||
BaseImage.__init__(self, *args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ from .video import EuroparlVideo
|
|||
|
||||
__all__ = ['VideoPage']
|
||||
|
||||
|
||||
class VideoPage(BasePage):
|
||||
def get_video(self, video=None):
|
||||
if video is None:
|
||||
|
|
@ -67,7 +68,7 @@ class VideoPage(BasePage):
|
|||
for span in self.parser.select(obj[0], 'span.ep_acronym, span.ep_theme'):
|
||||
if span.text_content():
|
||||
title += ' ' + span.text_content().strip()
|
||||
|
||||
|
||||
return title
|
||||
|
||||
def set_details(self, v):
|
||||
|
|
@ -89,7 +90,7 @@ class VideoPage(BasePage):
|
|||
day=int(day),
|
||||
hour=int(hour),
|
||||
minute=int(minute))
|
||||
|
||||
|
||||
obj = self.parser.select(self.document.getroot(), 'span.ep_subtitle', 1)
|
||||
if obj is not None:
|
||||
span = self.parser.select(obj, 'span.ep_date', 1)
|
||||
|
|
@ -104,7 +105,7 @@ class VideoPage(BasePage):
|
|||
day = m.group(5)
|
||||
month = m.group(6)
|
||||
year = m.group(7)
|
||||
|
||||
|
||||
start = datetime.datetime(year=int(year),
|
||||
month=int(month),
|
||||
day=int(day),
|
||||
|
|
|
|||
|
|
@ -47,4 +47,3 @@ class EuroparlVideo(BaseVideo):
|
|||
if m:
|
||||
return u'http://www.europarl.europa.eu/ep-live/en/plenary/video?debate=%s' % _id
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from .pages.accounts_list import GlobalAccountsList, AccountsList, AccountHistor
|
|||
|
||||
__all__ = ['Fortuneo']
|
||||
|
||||
|
||||
class Fortuneo(BaseBrowser):
|
||||
DOMAIN_LOGIN = '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),
|
||||
]
|
||||
|
||||
|
||||
class AccountHistoryPage(BasePage):
|
||||
def get_operations(self, _id):
|
||||
"""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
|
||||
|
||||
|
||||
class AccountsList(BasePage):
|
||||
def on_loaded(self):
|
||||
warn = self.document.xpath('//div[@id="message_renouvellement_mot_passe"]')
|
||||
|
|
@ -156,6 +158,7 @@ class AccountsList(BasePage):
|
|||
|
||||
yield account
|
||||
|
||||
|
||||
class GlobalAccountsList(BasePage):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from weboob.tools.browser import BasePage, BrowserUnavailable
|
|||
|
||||
__all__ = ['LoginPage']
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
msgb = self.document.xpath(".//*[@id='message_client']/text()")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class FortuneoTest(BackendTest):
|
||||
BACKEND = 'fortuneo'
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
from logging import debug
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class FourChanTest(BackendTest):
|
||||
BACKEND = 'fourchan'
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
from weboob.tools.test import BackendTest
|
||||
from weboob.capabilities.video import BaseVideo
|
||||
|
||||
|
||||
class PluzzTest(BackendTest):
|
||||
BACKEND = 'francetelevisions'
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class LoginPage(BasePage):
|
|||
self.browser['LoginPortletFormPassword1'] = passwd.encode(self.browser.ENCODING)
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class AccountsPage(BasePage):
|
||||
ACCOUNT_TYPES = {u'Solde des comptes bancaires - Groupama Banque': Account.TYPE_CHECKING,
|
||||
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),
|
||||
]
|
||||
|
||||
|
||||
class TransactionsPage(BasePage):
|
||||
def get_history(self):
|
||||
count = 0
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class GanAssurancesTest(BackendTest):
|
||||
BACKEND = 'ganassurances'
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class GazelleTest(BackendTest):
|
||||
BACKEND = 'gazelle'
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ from .video import GDCVaultVideo
|
|||
|
||||
__all__ = ['VideoPage']
|
||||
|
||||
|
||||
class VideoPage(BasePage):
|
||||
def get_video(self, video=None):
|
||||
if video is None:
|
||||
|
|
@ -127,7 +128,7 @@ class VideoPage(BasePage):
|
|||
day=int(day),
|
||||
hour=int(hour),
|
||||
minute=int(minute))
|
||||
|
||||
|
||||
obj = self.parser.select(self.document.getroot(), 'span.ep_subtitle', 1)
|
||||
if obj is not None:
|
||||
span = self.parser.select(obj, 'span.ep_date', 1)
|
||||
|
|
@ -142,7 +143,7 @@ class VideoPage(BasePage):
|
|||
day = m.group(5)
|
||||
month = m.group(6)
|
||||
year = m.group(7)
|
||||
|
||||
|
||||
start = datetime.datetime(year=int(year),
|
||||
month=int(month),
|
||||
day=int(day),
|
||||
|
|
|
|||
|
|
@ -41,4 +41,3 @@ class GDCVaultVideo(BaseVideo):
|
|||
if m:
|
||||
return u'http://www.gdcvault.com/play/%s#slides' % _id
|
||||
return u'http://www.gdcvault.com/play/%s' % _id
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class GeolocIPTest(BackendTest):
|
||||
BACKEND = 'geolocip'
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class GoogleTranslateBrowser(BaseBrowser):
|
|||
PAGES = {
|
||||
'https?://translate\.google\.com': TranslatePage
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ from weboob.tools.browser import BaseBrowser
|
|||
from .pages import ValidationPage, HomePage, HistoryPage, StoryPage, AuthorPage
|
||||
|
||||
# Browser
|
||||
|
||||
|
||||
class HDSBrowser(BaseBrowser):
|
||||
ENCODING = 'ISO-8859-1'
|
||||
DOMAIN = 'histoires-de-sexe.net'
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ __all__ = ['HSBC']
|
|||
class NotLoggedPage(BasePage):
|
||||
pass
|
||||
|
||||
|
||||
class HSBC(BaseBrowser):
|
||||
DOMAIN = 'client.hsbc.fr'
|
||||
PROTOCOL = 'https'
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class AccountsListPage(BasePage):
|
|||
|
||||
return iter(accounts)
|
||||
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile('^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
|
||||
(re.compile('^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
|
||||
|
|
@ -85,6 +86,7 @@ class Transaction(FrenchTransaction):
|
|||
(re.compile('^REMISE (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||
]
|
||||
|
||||
|
||||
class HistoryPage(BasePage):
|
||||
def get_next_link(self):
|
||||
return None
|
||||
|
|
@ -92,6 +94,7 @@ class HistoryPage(BasePage):
|
|||
def get_operations(self, num_page, date_guesser):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class CPTHistoryPage(HistoryPage):
|
||||
def get_operations(self, num_page, date_guesser):
|
||||
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)
|
||||
yield op
|
||||
|
||||
|
||||
class CardHistoryPage(HistoryPage):
|
||||
def get_next_link(self):
|
||||
ok = False
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class HSBCTest(BackendTest):
|
||||
BACKEND = 'hsbc'
|
||||
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ dict_hex = {'á': u'á',
|
|||
'â': u'â',
|
||||
'ç': u'ç'
|
||||
}
|
||||
|
||||
|
||||
def latin2unicode(word):
|
||||
for key in dict_hex.keys():
|
||||
word = word.replace(key,dict_hex[key])
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ class PersonPage(BasePage):
|
|||
person.thumbnail_url = thumbnail_url
|
||||
return person
|
||||
|
||||
|
||||
class FilmographyPage(BasePage):
|
||||
''' Page of detailed filmography of a person, sorted by type of role
|
||||
This page is easier to parse than the main person page filmography
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class ImdbTest(BackendTest):
|
||||
BACKEND = 'imdb'
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ class ImdbTest(BackendTest):
|
|||
movies = list(self.backend.iter_movies('spiderman'))
|
||||
for movie in movies:
|
||||
assert movie.id
|
||||
|
||||
|
||||
def test_get_movie(self):
|
||||
movie = self.backend.get_movie('tt0079980')
|
||||
assert movie.id
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class INATest(BackendTest):
|
||||
BACKEND = 'ina'
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
|||
|
||||
__all__ = ['AccountsList']
|
||||
|
||||
|
||||
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),
|
||||
(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 .tools import rssid
|
||||
|
||||
|
||||
class NewspaperInrocksBackend(GenericNewspaperBackend, ICapMessages):
|
||||
MAINTAINER = u'Julien Hebert'
|
||||
EMAIL = 'juke@free.fr'
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage, t
|
|||
try_remove_from_selector_list, \
|
||||
drop_comments, NoneMainDiv
|
||||
|
||||
|
||||
class ArticlePage(GenericNewsPage):
|
||||
"ArticlePage object for inrocks"
|
||||
def on_loaded(self):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage
|
||||
|
||||
|
||||
class InrocksTvPage(GenericNewsPage):
|
||||
"ArticlePage object for inrocks"
|
||||
def on_loaded(self):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
import re
|
||||
|
||||
|
||||
def id2url(_id):
|
||||
"return an url from an id"
|
||||
regexp2 = re.compile("(\w+).([0-9]+).(.*$)")
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ class IpinfodbBackend(BaseBackend, ICapGeolocIp):
|
|||
if 'Invalid IP or domain name' in content:
|
||||
raise Exception('Bad parameter')
|
||||
else:
|
||||
tab = {'City' : 'NA' ,\
|
||||
'Country name' : 'NA' ,\
|
||||
'Region' : 'NA' ,\
|
||||
'Latitude' : 'NA' ,\
|
||||
'Longitude' : 'NA' ,\
|
||||
'hostname' : 'NA' ,\
|
||||
tab = {'City' : 'NA' ,
|
||||
'Country name' : 'NA' ,
|
||||
'Region' : 'NA' ,
|
||||
'Latitude' : 'NA' ,
|
||||
'Longitude' : 'NA' ,
|
||||
'hostname' : 'NA' ,
|
||||
'zipcode' : 'NA'}
|
||||
line = ''
|
||||
for line in content.split('\n'):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
from weboob.tools.test import BackendTest
|
||||
|
||||
|
||||
class IpinfodbTest(BackendTest):
|
||||
BACKEND = 'ipinfodb'
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest
|
|||
|
||||
from random import choice
|
||||
|
||||
|
||||
class IsohuntTest(BackendTest):
|
||||
BACKEND = 'isohunt'
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class TorrentPage(BasePage):
|
|||
for span in self.document.getiterator('span'):
|
||||
# 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
|
||||
if (span.attrib.get('class', '') == 'folder' \
|
||||
if (span.attrib.get('class', '') == 'folder'
|
||||
or span.attrib.get('class', '') == 'folderopen') \
|
||||
and len(span.getchildren()) > 2:
|
||||
size = span.getchildren()[1].tail
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from weboob.capabilities.base import NotLoaded
|
|||
import urllib
|
||||
from random import choice
|
||||
|
||||
|
||||
class KickassTest(BackendTest):
|
||||
BACKEND = 'kickass'
|
||||
|
||||
|
|
|
|||
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