summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/UlozTo.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
commitf5535809bebc6cc343475704832c8fd8674d2d06 (patch)
treec59bc1e6d71c04f5545ea262056c0c5be1bd8910 /module/plugins/accounts/UlozTo.py
parentFixed PEP 8 violations in Hosters (diff)
downloadpyload-f5535809bebc6cc343475704832c8fd8674d2d06.tar.xz
Fixed PEP 8 violations in Accounts
Diffstat (limited to 'module/plugins/accounts/UlozTo.py')
-rw-r--r--module/plugins/accounts/UlozTo.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py
index 6652c8b7c..dc59db9cc 100644
--- a/module/plugins/accounts/UlozTo.py
+++ b/module/plugins/accounts/UlozTo.py
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
-from module.plugins.Account import Account
import re
+from module.plugins.Account import Account
+
+
class UlozTo(Account):
__name__ = "UlozTo"
__version__ = "0.04"
@@ -10,27 +12,27 @@ class UlozTo(Account):
__description__ = """uloz.to account plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="http://www.ulozto.net/kredit" title="[^"]*?GB = ([0-9.]+) MB"'
def loadAccountInfo(self, user, req):
#this cookie gets lost somehow after each request
- self.phpsessid = req.cj.getCookie("ULOSESSID")
- html = req.load("http://www.ulozto.net/", decode = True)
- req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid)
-
+ self.phpsessid = req.cj.getCookie("ULOSESSID")
+ html = req.load("http://www.ulozto.net/", decode=True)
+ req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid)
+
found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- trafficleft = int(float(found.group(1).replace(' ','').replace(',','.')) * 1000 / 1.024) if found else 0
+ trafficleft = int(float(found.group(1).replace(' ', '').replace(',', '.')) * 1000 / 1.024) if found else 0
self.premium = True if trafficleft else False
-
+
return {"validuntil": -1, "trafficleft": trafficleft}
-
+
def login(self, user, data, req):
- html = req.load('http://www.ulozto.net/login?do=loginForm-submit', post = {
+ html = req.load('http://www.ulozto.net/login?do=loginForm-submit', post={
"login": "Submit",
"password": data['password'],
- "username": user
- }, decode = True)
-
+ "username": user
+ }, decode=True)
+
if '<ul class="error">' in html:
self.wrongPassword()