diff --git a/modules/hsbchk/browser.py b/modules/hsbchk/browser.py index bb3b017ddc406ebf50d835fb24ce20c339d797b0..f3ab55f5f14311213d9ab44d70a8e42e06b5284e 100755 --- a/modules/hsbchk/browser.py +++ b/modules/hsbchk/browser.py @@ -103,7 +103,6 @@ def open(self, *args, **kwargs): def do_login(self): self.auth_token = None - self.logger.debug("currrent state is Logged:%s", self.logged) super(HSBCHK, self).do_login() self.auth_token = self.session.cookies.get('SYNC_TOKEN') self.logged = True diff --git a/modules/hsbchk/module.py b/modules/hsbchk/module.py index d78cc669d9a7da9523915ead9c320f9a496385f7..3ead5dae0604f9b7547ae0ae757470a9ec88c7f1 100755 --- a/modules/hsbchk/module.py +++ b/modules/hsbchk/module.py @@ -60,7 +60,7 @@ def iter_history(self, account): yield tr def iter_investment(self, account): - raise NotImplemented + raise NotImplementedError def iter_coming(self, account): # No coming entries on HSBC HK diff --git a/modules/hsbchk/pages/account_pages.py b/modules/hsbchk/pages/account_pages.py index 2e5bc308b522428931805d185ab7d27a8e864ea6..353771ba2792e8cf4e73c6a3dea17e8b81a71049 100755 --- a/modules/hsbchk/pages/account_pages.py +++ b/modules/hsbchk/pages/account_pages.py @@ -21,8 +21,6 @@ import re from decimal import Decimal -import requests -import json from weboob.browser.elements import DictElement, ItemElement, method from weboob.browser.filters.json import Dict @@ -125,15 +123,10 @@ def iter_accounts(self): res = Account.from_dict(self.get_acc_dict(subacc)) if subacc.get('hasAcctDetails'): yield res - else: - self.logger.debug("skip account with no history: %s", res) elif acc_prod == "CC": - self.logger.debug("acc: %s", str(acc)) res = Account.from_dict(self.get_acc_dict(acc)) if acc.get('hasAcctDetails'): yield res - else: - self.logger.debug("skip account with no history: %s", res) else: self.logger.error("Unknown account product code [%s]", acc_prod) @@ -146,10 +139,6 @@ class iter_history(DictElement): item_xpath = "txnSumm" def next_page(self): - self.logger.debug( - "paging (%s): %s", - Dict('responsePagingInfo/moreRecords', default='N')(self.page.doc), - self.page.doc.get('responsePagingInfo')) if Dict('responsePagingInfo/moreRecords', default='N')(self.page.doc) == 'Y': self.logger.info("more values are available") """ diff --git a/modules/hsbchk/sbrowser.py b/modules/hsbchk/sbrowser.py index 1542a5510e11fcb8c3d0676b642de8d0d25563da..e60224b337e16509c489544573460fe6d1d799f4 100755 --- a/modules/hsbchk/sbrowser.py +++ b/modules/hsbchk/sbrowser.py @@ -19,15 +19,6 @@ from __future__ import unicode_literals -import os - -try: - from selenium import webdriver -except ImportError: - raise ImportError('Please install python-selenium') - -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities -from selenium.webdriver.common.proxy import Proxy, ProxyType from selenium.common.exceptions import ( TimeoutException ) @@ -35,7 +26,7 @@ from selenium.webdriver.support import expected_conditions as EC from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, BrowserHTTPError -from weboob.browser.selenium import (SeleniumBrowser, DirFirefoxProfile, VisibleXPath) +from weboob.browser.selenium import (SeleniumBrowser, VisibleXPath) from weboob.browser import URL from .pages.login import ( @@ -45,8 +36,6 @@ class LoginBrowser(SeleniumBrowser): BASEURL = 'https://www.hsbc.com.hk/' - #DRIVER = webdriver.Remote - app_gone = False preconnection = URL(r'https://www.ebanking.hsbc.com.hk/1/2/logon?LANGTAG=en&COUNTRYTAG=US', LoginPage) @@ -65,59 +54,10 @@ def _build_capabilities(self): capa['marionette'] = True return capa - def _setup_driver(self): - proxy = Proxy() - proxy.proxy_type = ProxyType.DIRECT - if 'http' in self.proxy: - proxy.http_proxy = self.proxy['http'] - if 'https' in self.proxy: - proxy.ssl_proxy = self.proxy['https'] - - capa = self._build_capabilities() - proxy.add_to_capabilities(capa) - - options = self._build_options() - # TODO some browsers don't need headless - # TODO handle different proxy setting? - options.set_headless(self.HEADLESS) - - if self.DRIVER is webdriver.Firefox: - if self.responses_dirname and not os.path.isdir(self.responses_dirname): - os.makedirs(self.responses_dirname) - - options.profile = DirFirefoxProfile(self.responses_dirname) - if self.responses_dirname: - capa['profile'] = self.responses_dirname - self.driver = self.DRIVER(options=options, capabilities=capa) - elif self.DRIVER is webdriver.Chrome: - self.driver = self.DRIVER(options=options, desired_capabilities=capa) - elif self.DRIVER is webdriver.PhantomJS: - if self.responses_dirname: - if not os.path.isdir(self.responses_dirname): - os.makedirs(self.responses_dirname) - log_path = os.path.join(self.responses_dirname, 'selenium.log') - else: - log_path = NamedTemporaryFile(prefix='weboob_selenium_', suffix='.log', delete=False).name - - self.driver = self.DRIVER(desired_capabilities=capa, service_log_path=log_path) - elif self.DRIVER is webdriver.Remote: - # self.HEADLESS = False - # for debugging purpose - self.driver = webdriver.Remote( - command_executor='http://:/wd/hub', - desired_capabilities=DesiredCapabilities.FIREFOX) - else: - raise NotImplementedError() - - if self.WINDOW_SIZE: - self.driver.set_window_size(*self.WINDOW_SIZE) - - def load_state(self, state): return def do_login(self): - self.logger.debug("start do_login") self.app_gone = False self.preconnection.go() diff --git a/modules/hsbchk/test.py b/modules/hsbchk/test.py index 92e3a6810e31bb6f49a09f268dcdae03f3270553..c6bef05fdf6083cf4a1b66dd4cbe8fe3477115cc 100644 --- a/modules/hsbchk/test.py +++ b/modules/hsbchk/test.py @@ -19,7 +19,6 @@ from weboob.tools.test import BackendTest -from weboob.capabilities.bank import Account class HSBCHKTest(BackendTest): MODULE = 'hsbchk' diff --git a/tools/py3-compatible.modules b/tools/py3-compatible.modules index 8e27decf7399427a3a47bf238e5c15bad1678df7..65ace663a940429fccd0419a0a3497b78f650e0a 100644 --- a/tools/py3-compatible.modules +++ b/tools/py3-compatible.modules @@ -82,6 +82,7 @@ gmf googletranslate groupamaes hsbc +hsbchk hybride imdb imgur