pax_global_header 0000666 0000000 0000000 00000000064 11666415431 0014521 g ustar 00root root 0000000 0000000 52 comment=037c35f40908f1833bda001fd8cdb2c9338a53d4
woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/ 0000775 0000000 0000000 00000000000 11666415431 0024260 5 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/ 0000775 0000000 0000000 00000000000 11666415431 0025535 5 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/ 0000775 0000000 0000000 00000000000 11666415431 0027307 5 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues/ 0000775 0000000 0000000 00000000000 11666415431 0031151 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000000104 11666415431 0033176 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues from .backend import BouyguesBackend
__all__ = ['BouyguesBackend']
backend.py 0000664 0000000 0000000 00000003531 11666415431 0033035 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from __future__ import with_statement
from weboob.capabilities.messages import CantSendMessage, ICapMessages, ICapMessagesPost
from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword, Value
from .browser import BouyguesBrowser
__all__ = ['BouyguesBackend']
class BouyguesBackend(BaseBackend, ICapMessages, ICapMessagesPost):
NAME = 'bouygues'
MAINTAINER = 'Christophe Benz'
EMAIL = 'christophe.benz@gmail.com'
VERSION = '0.9.1'
DESCRIPTION = 'Bouygues french mobile phone provider'
LICENSE = 'AGPLv3+'
CONFIG = BackendConfig(Value('login', label='Login'),
ValueBackendPassword('password', label='Password'))
BROWSER = BouyguesBrowser
ACCOUNT_REGISTER_PROPERTIES = None
def create_default_browser(self):
return self.create_browser(self.config['login'].get(), self.config['password'].get())
def post_message(self, message):
if not message.content.strip():
raise CantSendMessage(u'Message content is empty.')
with self.browser:
self.browser.post_message(message)
browser.py 0000664 0000000 0000000 00000005044 11666415431 0033132 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from .pages.compose import ComposeFrame, ComposePage, ConfirmPage, SentPage
from .pages.login import LoginPage, LoginSASPage
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
__all__ = ['BouyguesBrowser']
class BouyguesBrowser(BaseBrowser):
DOMAIN = 'www.bouyguestelecom.fr'
PAGES = {
'http://www.espaceclient.bouyguestelecom.fr/ECF/jsf/client/envoiSMS/viewEnvoiSMS.jsf': ComposePage,
'http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/sendSMS.phtml': ComposeFrame,
'http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/confirmSendSMS.phtml': ConfirmPage,
'https://www.espaceclient.bouyguestelecom.fr/ECF/jsf/submitLogin.jsf': LoginPage,
'https://www.espaceclient.bouyguestelecom.fr/ECF/SasUnifie': LoginSASPage,
'http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/resultSendSMS.phtml': SentPage,
}
def home(self):
self.location('http://www.espaceclient.bouyguestelecom.fr/ECF/jsf/client/envoiSMS/viewEnvoiSMS.jsf')
def is_logged(self):
return 'code' not in [form.name for form in self.forms()]
def login(self):
self.location('https://www.espaceclient.bouyguestelecom.fr/ECF/jsf/submitLogin.jsf', no_login=True)
self.page.login(self.username, self.password)
assert self.is_on_page(LoginSASPage)
self.page.login()
if not self.is_logged():
raise BrowserIncorrectPassword()
def post_message(self, message):
if not self.is_on_page(ComposeFrame):
self.home()
self.location('http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/sendSMS.phtml')
self.page.post_message(message)
assert self.is_on_page(ConfirmPage)
self.page.confirm()
assert self.is_on_page(SentPage)
pages/ 0000775 0000000 0000000 00000000000 11666415431 0032171 5 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues __init__.py 0000664 0000000 0000000 00000000000 11666415431 0034270 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues/pages compose.py 0000664 0000000 0000000 00000003156 11666415431 0034215 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues/pages # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
import re
from weboob.capabilities.messages import CantSendMessage
from weboob.tools.browser import BasePage
__all__ = ['ComposeFrame', 'ComposePage', 'ConfirmPage', 'SentPage']
class ComposeFrame(BasePage):
phone_regex = re.compile('^(\+33|0033|0)(6|7)(\d{8})$')
def post_message(self, message):
receiver = message.thread.id
if self.phone_regex.match(receiver) is None:
raise CantSendMessage(u'Invalid receiver: %s' % receiver)
self.browser.select_form(nr=0)
self.browser['fieldMsisdn'] = receiver
self.browser['fieldMessage'] = message.content.encode('utf-8')
self.browser.submit()
class ComposePage(BasePage):
pass
class ConfirmPage(BasePage):
def confirm(self):
self.browser.location('http://www.mobile.service.bbox.bouyguestelecom.fr/services/SMSIHD/resultSendSMS.phtml')
class SentPage(BasePage):
pass
login.py 0000664 0000000 0000000 00000002243 11666415431 0033654 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues/pages # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.tools.browser import BasePage
__all__ = ['LoginPage', 'LoginSASPage']
class LoginPage(BasePage):
def login(self, login, password):
self.browser.select_form(name='code')
self.browser['j_username'] = login
self.browser['j_password'] = password
self.browser.submit()
class LoginSASPage(BasePage):
def login(self):
self.browser.select_form(name='redirect')
self.browser.submit()
test.py 0000664 0000000 0000000 00000001562 11666415431 0032427 0 ustar 00root root 0000000 0000000 woob-037c35f40908f1833bda001fd8cdb2c9338a53d4-weboob-backends-bouygues/weboob/backends/bouygues # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see .
from weboob.tools.test import BackendTest
class BouyguesTest(BackendTest):
BACKEND = 'bouygues'
def test_bouygues(self):
pass