add the 'register' backend parameter

This commit is contained in:
Romain Bignon 2010-07-15 23:37:54 +02:00
commit aea2cf0780
3 changed files with 15 additions and 4 deletions

View file

@ -49,6 +49,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating, ICapC
ICON = os.path.join(os.path.dirname(__file__), 'data/logo.png')
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
'register': BaseBackend.ConfigField(default=False, description='Register as new account?'),
}
STORAGE = {'profiles_walker': {'viewed': []},
'sluts': {},
@ -56,7 +57,18 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesReply, ICapDating, ICapC
BROWSER = AuMBrowser
def create_default_browser(self):
return self.create_browser(self.config['username'], self.config['password'])
if self.config['register']:
browser = self.create_browser(self.config['username'])
browser.register(password= self.config['password'],
sex= 0,
birthday_d= 1,
birthday_m= 1,
birthday_y= 1970,
zipcode= 75001,
country= 'fr',
godfather= '')
else:
return self.create_browser(self.config['username'], self.config['password'])
def get_status(self):
with self.browser:

View file

@ -104,11 +104,11 @@ class AuMBrowser(BaseBrowser):
return func(self, *args, **kwargs)
return inner
def register(self, nickname, password, sex, birthday_d, birthday_m, birthday_y, zipcode, country, godfather=''):
def register(self, password, sex, birthday_d, birthday_m, birthday_y, zipcode, country, godfather=''):
if not self.is_on_page(RegisterPage):
self.location('http://www.adopteunmec.com/register2.php')
return self.page.register(nickname, password, sex, birthday_d, birthday_m, birthday_y, zipcode, country, godfather)
return self.page.register(password, sex, birthday_d, birthday_m, birthday_y, zipcode, country, godfather)
@pageaccess
def add_photo(self, name, f):

View file

@ -156,7 +156,6 @@ class Decoder:
browser.openurl('/register2.php')
c = Captcha(browser.openurl('/captcha.php'))
print 'Decoded: %s' % c.text
for tile in c:
checksum = tile.checksum()