Fix freemobile module
This commit is contained in:
parent
8248c24840
commit
f308fed5ae
1 changed files with 20 additions and 9 deletions
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
|
||||
import Image
|
||||
import time
|
||||
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ class FreeKeyboard(object):
|
|||
'9':'001111111000110011111111100111111111111100111110000001100011110000001100011111111111111111011111111111111001111111111110'
|
||||
}
|
||||
fingerprints = []
|
||||
basepage = None
|
||||
|
||||
def __init__(self,basepage):
|
||||
for htmlimg in basepage.document.xpath('//img[@class="ident_chiffre_img pointer"]'):
|
||||
|
|
@ -57,6 +59,7 @@ class FreeKeyboard(object):
|
|||
s += "0"
|
||||
|
||||
self.fingerprints.append(s)
|
||||
self.basepage = basepage
|
||||
if self.DEBUG:
|
||||
image.save('/tmp/' + s + '.png')
|
||||
|
||||
|
|
@ -85,6 +88,7 @@ class FreeKeyboard(object):
|
|||
best = match
|
||||
result = i
|
||||
i += 1
|
||||
self.basepage.browser.logger.debug(self.fingerprints[result] + " match " + digit)
|
||||
return result
|
||||
|
||||
# TODO : exception
|
||||
|
|
@ -96,6 +100,11 @@ class FreeKeyboard(object):
|
|||
code+=str(codesymbol)
|
||||
return code
|
||||
|
||||
def get_small(self, string):
|
||||
for c in string:
|
||||
time.sleep(0.4)
|
||||
url = 'https://mobile.free.fr/moncompte/chiffre.php?pos=' + c + '&small=1'
|
||||
fichier = self.basepage.browser.openurl(url)
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
|
|
@ -108,7 +117,9 @@ class LoginPage(BasePage):
|
|||
# Fucking form without name...
|
||||
self.browser.select_form(nr=0)
|
||||
self.browser.set_all_readonly(False)
|
||||
self.browser['login_abo'] = vk.get_string_code(login)
|
||||
code = vk.get_string_code(login)
|
||||
self.browser['login_abo'] = code
|
||||
vk.get_small(code)
|
||||
self.browser['pwd_abo'] = password
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue