decoding captcha

This commit is contained in:
Romain Bignon 2010-07-15 22:08:41 +02:00
commit 7df272cf7a
3 changed files with 221 additions and 18 deletions

View file

@ -19,7 +19,7 @@
import re
from weboob.backends.aum.pages.base import PageBase
from logging import error
from logging import error, warning
class HomePage(PageBase):
@ -46,5 +46,5 @@ class HomePage(PageBase):
i += 1
if i == 3:
return int(font.firstChild.data)
logging.warning(u'Could not parse number of charms available')
warning(u'Could not parse number of charms available')
return 0

View file

@ -16,9 +16,11 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from weboob.backends.aum.pages.base import PageBase
from weboob.tools.browser import BrowserIncorrectPassword
from .base import PageBase
from ..captcha import Captcha
class LoginPage(PageBase):
def login(self, login, password):
self.browser.select_form(name="form_login")
@ -28,24 +30,26 @@ class LoginPage(PageBase):
self.browser.submit() # submit current form
class RegisterPage(PageBase):
def register(self, password, sex, birthday_d, birthday_m, birthday_y, zipcode, country, captcha):
def register(self, password, sex, birthday_d, birthday_m, birthday_y, zipcode, country):
"""
Form name=register (#1)
## ## __Name__________________ __Type___ __ID________ __Value__________________
1 sent1time hidden (None)
2 sex radio sex-0 [] of ['0', '1']
3 birthday0 select birthday0 ['0'] of ['0', '1', '2', '3', '4', ' ...
4 birthday1 select birthday1 ['0'] of ['0', '1', '2', '3', '4', ' ...
5 birthday2 select birthday2 ['0'] of ['0', '1992', '1991', '1990 ...
6 country select country ['0'] of ['0', 'fr', 'be', 'ch', 'ca']
7 zip text zip
8 email text email
9 pass password pass
10 pass_retype password pass_retype
11 captcha text captcha
12 swear_adult checkbox swear_adult [] of ['on']
13 want_goods checkbox want_goods [] of ['on']
1 sent1time hidden (None)
2 sex radio sex-0 [] of ['0', '1']
3 birthday0 select birthday0 ['0'] of ['0', '1', '2', '3', '4', ' ...
4 birthday1 select birthday1 ['0'] of ['0', '1', '2', '3', '4', ' ...
5 birthday2 select birthday2 ['0'] of ['0', '1992', '1991', '1990 ...
6 country select country ['0'] of ['0', 'fr', 'be', 'ch', 'ca']
7 zip text zip
8 email text email
9 pass password pass
10 pass_retype password pass_retype
11 captcha text captcha
12 swear_adult checkbox swear_adult [] of ['on']
13 want_goods checkbox want_goods [] of ['on']
"""
c = Captcha(self.browser.openurl('/captcha.php'))
self.browser.select_form(name='register')
self.browser.set_all_readonly(False)
@ -58,7 +62,7 @@ Form name=register (#1)
self.browser['email'] = self.browser.username
self.browser['pass'] = password
self.browser['pass_retype'] = password
self.browser['captcha'] = captcha
self.browser['captcha'] = c.text
self.browser['swear_adult'] = ['on']
self.browser['want_goods'] = []