The new woob repository is here: This gitlab will be removed soon.

Commit 2aed8a52 authored by Célande Adrien's avatar Célande Adrien Committed by Romain Bignon

[freemobile] handle profile

parent 31ea8bcf
......@@ -21,7 +21,7 @@
from weboob.capabilities.messages import CantSendMessage
from weboob.exceptions import BrowserIncorrectPassword
from import basestring
from .pages import HomePage, LoginPage, HistoryPage, DetailsPage, OptionsPage
from .pages import HomePage, LoginPage, HistoryPage, DetailsPage, OptionsPage, ProfilePage
__all__ = ['Freemobile']
......@@ -32,6 +32,7 @@ class Freemobile(LoginBrowser):
homepage = URL('index.php\?page=home', HomePage)
detailspage = URL('index.php\?page=suiviconso', DetailsPage)
optionspage = URL('index.php\?page=options&o=(?P<username>)', OptionsPage)
profile = URL('index.php\?page=coordonnees', ProfilePage)
loginpage = URL('index.php', LoginPage)
historypage = URL('ajax.php\?page=consotel_current_month', HistoryPage)
sendAPI = URL('\?user=(?P<username>)&pass=(?P<apikey>)&msg=(?P<msg>)')
......@@ -95,3 +96,8 @@ def post_message(self, message):
username=username, apikey=api_key,
def get_profile(self):
......@@ -18,6 +18,7 @@
# along with weboob. If not, see <>.
from weboob.capabilities.bill import CapDocument, Subscription, Bill, SubscriptionNotFound, DocumentNotFound
from weboob.capabilities.profile import CapProfile
from weboob.capabilities.messages import CantSendMessage, CapMessages, CapMessagesPost
from weboob.capabilities.base import find_object
from import Module, BackendConfig
......@@ -29,7 +30,7 @@
__all__ = ['FreeMobileModule']
class FreeMobileModule(Module, CapDocument, CapMessages, CapMessagesPost):
class FreeMobileModule(Module, CapDocument, CapMessages, CapMessagesPost, CapProfile):
NAME = 'freemobile'
MAINTAINER = u'Florent Fourcot'
EMAIL = ''
......@@ -85,3 +86,6 @@ def post_message(self, message):
if not message.content.strip():
raise CantSendMessage(u'Message content is empty.')
return self.browser.post_message(message)
def get_profile(self):
return self.browser.get_profile()
......@@ -22,5 +22,6 @@
from .history import HistoryPage, DetailsPage
from .login import LoginPage
from .options import OptionsPage
from .profile import ProfilePage
__all__ = ['LoginPage', 'HomePage', 'HistoryPage', 'DetailsPage', 'OptionsPage']
__all__ = ['LoginPage', 'HomePage', 'HistoryPage', 'DetailsPage', 'OptionsPage', 'ProfilePage']
# -*- coding: utf-8 -*-
# Copyright(C) 2012-2014 Florent Fourcot
# 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
# 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 unicode_literals
from weboob.browser.pages import HTMLPage, LoggedPage
from weboob.capabilities.profile import Profile
from weboob.browser.filters.standard import CleanText, Regexp
class ProfilePage(LoggedPage, HTMLPage):
def get_profile(self):
p = Profile() = CleanText('//div[address]/div')(self.doc)
p.address = CleanText('//div/address')(self.doc) = CleanText('//div[contains(text(), "Mon email")]/span')(self.doc)
for phone in self.doc.xpath('//div[@id="containerRIO"]//option[not(@value="")]'):
if == Regexp(CleanText('.'), r'(.*) - \d{10}')(phone): = Regexp(CleanText('.'), r'(\d{10})')(phone)
return p
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment