[\s\w<>=-":;]*
.*?(.*?)'
TRAFFIC_PATTERN = r'
([0-9.]+ [kMG]B)'
def loadAccountInfo(self, user, req):
premium = False
validuntil = -1
trafficleft = -1
html = req.load("http://catshare.net/", decode=True)
try:
m = re.search(self.PREMIUM_PATTERN, html)
if "Premium" in m.group(1):
premium = True
except Exception:
pass
try:
m = re.search(self.VALID_UNTIL_PATTERN, html)
expiredate = m.group(1)
if "-" not in expiredate:
validuntil = mktime(strptime(expiredate, "%d.%m.%Y"))
m = re.search(TRAFFIC_PATTERN, html)
if m:
trafficleft = int(self.parseTraffic(m.group(1)))
except Exception:
pass
return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil}
def login(self, user, data, req):
html = req.load("http://catshare.net/login",
post={'user_email': user,
'user_password': data['password'],
'remindPassword': 0,
'user[submit]': "Login"},
decode=True)
if not 'Wyloguj' in html:
self.wrongPassword()