Commit 14a7a1d3 authored by Romain Bignon's avatar Romain Bignon

support repositories to manage backends (closes #747)

parent ef16a5b7
......@@ -23,23 +23,35 @@ try:
except ImportError, e:
from pysqlite2 import dbapi2 as sqlite
from weboob.core import Weboob
from weboob.core.modules import ModuleLoadError
import sys
import logging
level = logging.DEBUG
logging.basicConfig(stream=sys.stdout, level=level)
from weboob.backends.hds.browser import HDSBrowser
def main(filename):
weboob = Weboob()
try:
hds = weboob.modules_loader.load_module('hds')
except ModuleLoadError, e:
print >>sys.stderr, 'Unable to load "hds" module: %s' % e
return 1
try:
db = sqlite.connect(database=filename, timeout=10.0)
except sqlite.OperationalError, err:
print 'Unable to open %s database: %s' % (filename, err)
print >>sys.stderr, 'Unable to open %s database: %s' % (filename, err)
return 1
sys.stdout.write('Reading database... ')
sys.stdout.flush()
results = db.execute('SELECT id, author FROM stories')
try:
results = db.execute('SELECT id, author FROM stories')
except sqlite.OperationalError, err:
print >>sys.stderr, 'fail!\nUnable to read database: %s' % err
return 1
stored = set()
authors = set()
for r in results:
......@@ -48,7 +60,7 @@ def main(filename):
stored_authors = set([s[0] for s in db.execute('SELECT name FROM authors')])
sys.stdout.write('ok\n')
br = HDSBrowser()
br = hds.browser.HDSBrowser()
to_fetch = set()
sys.stdout.write('Getting stories list from website... ')
sys.stdout.flush()
......
......@@ -157,7 +157,7 @@ class Decoder:
self.hash = {}
def process(self):
from weboob.backends.aum.browser import AuMBrowser
from aum.browser import AuMBrowser
browser = AuMBrowser('')
browser.openurl('/register2.php')
c = Captcha(browser.openurl('/captcha.php'))
......
......@@ -28,9 +28,9 @@ from weboob.capabilities.account import AccountRegisterError
from weboob.tools.log import getLogger
from weboob.tools.value import Value, ValuesDict, ValueInt
from weboob.backends.aum.captcha import CaptchaError
from weboob.backends.aum.exceptions import AdopteWait, AdopteBanned
from weboob.backends.aum.browser import AuMBrowser
from aum.captcha import CaptchaError
from aum.exceptions import AdopteWait, AdopteBanned
from aum.browser import AuMBrowser
__all__ = ['PriorityConnection']
......
......@@ -23,7 +23,7 @@ from logging import warning
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.capabilities.bank import TransferError, Transfer
from weboob.backends.bnporc import pages
from bnporc import pages
from .errors import PasswordExpired
......
......@@ -20,7 +20,7 @@
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.backends.boursorama import pages
from boursorama import pages
from datetime import date
from dateutil.relativedelta import relativedelta
......
......@@ -20,7 +20,7 @@
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.capabilities.bank import Transfer, TransferError
from weboob.backends.cragr import pages
from cragr import pages
import mechanize
from datetime import datetime
import re
......