Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
179
Issues
179
List
Boards
Labels
Milestones
Merge Requests
53
Merge Requests
53
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
e0dd263d
Commit
e0dd263d
authored
Dec 30, 2020
by
thibault douge
Committed by
Vincent A
Jan 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[freemobile] raise an error if we can't go on the offer page
parent
2837d6e9
Pipeline
#3520
passed with stages
in 16 minutes and 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
modules/freemobile/browser.py
modules/freemobile/browser.py
+12
-3
modules/freemobile/pages.py
modules/freemobile/pages.py
+1
-1
No files found.
modules/freemobile/browser.py
View file @
e0dd263d
...
...
@@ -19,11 +19,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
unicode_literals
import
itertools
from
weboob.browser
import
LoginBrowser
,
URL
,
need_login
from
weboob.capabilities.messages
import
CantSendMessage
from
weboob.exceptions
import
BrowserIncorrectPassword
from
weboob.exceptions
import
BrowserIncorrectPassword
,
BrowserUnavailable
from
.pages
import
LoginPage
,
BillsPage
,
ProfilePage
,
PdfPage
,
OfferPage
,
OptionsPage
...
...
@@ -61,8 +63,15 @@ class Freemobile(LoginBrowser):
@
need_login
def
iter_subscription
(
self
):
offerpage
=
self
.
offerpage
.
stay_or_go
()
subscriptions
=
itertools
.
chain
([
offerpage
.
get_first_subscription
()],
offerpage
.
iter_next_subscription
())
self
.
offerpage
.
stay_or_go
()
if
self
.
login_page
.
is_here
():
error
=
self
.
page
.
get_error
()
if
'Vous ne pouvez pas avoir accès à cette page'
in
error
:
raise
BrowserUnavailable
(
error
)
elif
error
:
raise
AssertionError
(
'Unexpected error at subscription:
%
s'
%
error
)
subscriptions
=
itertools
.
chain
([
self
.
page
.
get_first_subscription
()],
self
.
page
.
iter_next_subscription
())
for
subscription
in
subscriptions
:
self
.
login_page
.
go
(
params
=
{
"switch-user"
:
subscription
.
_userid
})
...
...
modules/freemobile/pages.py
View file @
e0dd263d
...
...
@@ -39,7 +39,7 @@ class LoginPage(HTMLPage):
form
.
submit
()
def
get_error
(
self
):
return
CleanText
(
'//div[
@class="flash flash-error"
]'
)(
self
.
doc
)
return
CleanText
(
'//div[
has-class("flash")
]'
)(
self
.
doc
)
class
BillsPage
(
LoggedPage
,
HTMLPage
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment