Commit d8b74c43 authored by Théo Dorée's avatar Théo Dorée Committed by Romain Bignon

[ovh] Added condition on login (sometimes trying to log when already logged)

parent 218344b9
......@@ -33,9 +33,13 @@ class OvhBrowser(LoginBrowser):
profile = URL('/engine/api/me', ProfilePage)
documents = URL('/engine/2api/sws/billing/bills\?count=0&date=(?P<fromDate>.*)&dateTo=(?P<toDate>.*)&offset=0', BillsPage)
def do_login(self):
self.login.go().login(self.username, self.password)
return, self.password)
......@@ -28,7 +28,7 @@ from weboob.exceptions import ActionNeeded
class LoginPage(HTMLPage):
def is_logged(self):
return not self.doc.xpath('//div[has-class("error")]')
return not self.doc.xpath('//div[has-class("error")]') and not self.doc.xpath('//form//input[contains(@placeholder, "Account ID")]')
def login(self, login, password):
form = self.get_form('//form[@class="pagination-centered"]')
......@@ -44,6 +44,7 @@ class LoginPage(HTMLPage):
if double_auth:
raise ActionNeeded(CleanText('(//div[contains(., "Two-Factor")])[5]')(self.doc))
class ProfilePage(LoggedPage, JsonPage):
class get_list(ListElement):
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