use exception AdopteBanned instead of BrowserUnavailable
This commit is contained in:
parent
fd3ccda664
commit
26e7604cd4
2 changed files with 6 additions and 4 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from weboob.tools.browser import BasePage, BrowserUnavailable
|
from weboob.tools.browser import BasePage, BrowserUnavailable
|
||||||
|
from weboob.backends.aum.exceptions import AdopteBanned
|
||||||
|
|
||||||
class PageBase(BasePage):
|
class PageBase(BasePage):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
@ -27,12 +28,12 @@ class PageBase(BasePage):
|
||||||
b = self.document.getElementsByTagName('body')[0]
|
b = self.document.getElementsByTagName('body')[0]
|
||||||
for div in b.getElementsByTagName('div'):
|
for div in b.getElementsByTagName('div'):
|
||||||
if div.getAttribute('id') == 'oops':
|
if div.getAttribute('id') == 'oops':
|
||||||
raise BrowserUnavailable()
|
raise BrowserUnavailable('Oops')
|
||||||
|
|
||||||
# Check when the account is temporarily blocked.
|
# Check when the account is temporarily blocked.
|
||||||
for img in self.document.getElementsByTagName('img'):
|
for img in self.document.getElementsByTagName('img'):
|
||||||
if img.getAttribute('src') == 'http://s.adopteunmec.com/img/exemple.jpg':
|
if img.getAttribute('src') == 'http://s.adopteunmec.com/img/exemple.jpg':
|
||||||
raise BrowserUnavailable('Your account is blocked. You have to unblock by yourself but we can\'t help you.')
|
raise AdopteBanned('Your account is blocked. You have to unblock by yourself but we can\'t help you.')
|
||||||
|
|
||||||
def open_contact_list_page(self):
|
def open_contact_list_page(self):
|
||||||
self.browser.follow_link(url_regex=r"/mails.php$")
|
self.browser.follow_link(url_regex=r"/mails.php$")
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from weboob.tools.mech import ClientForm
|
from weboob.tools.mech import ClientForm
|
||||||
from weboob.tools.browser import BrowserIncorrectPassword, BrowserUnavailable
|
from weboob.tools.browser import BrowserIncorrectPassword
|
||||||
|
from weboob.backends.aum.exceptions import AdopteBanned
|
||||||
from weboob.capabilities.account import AccountRegisterError
|
from weboob.capabilities.account import AccountRegisterError
|
||||||
|
|
||||||
from .base import PageBase
|
from .base import PageBase
|
||||||
|
|
@ -114,7 +115,7 @@ class RedirectPage(PageBase):
|
||||||
|
|
||||||
class BanPage(PageBase):
|
class BanPage(PageBase):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserUnavailable('Your IP address is banned.')
|
raise AdopteBanned('Your IP address is banned.')
|
||||||
|
|
||||||
class ShopPage(PageBase):
|
class ShopPage(PageBase):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue