summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/NoPremiumPl.py
diff options
context:
space:
mode:
authorGravatar synweap15 <shamdog+github@gmail.com> 2014-07-09 12:02:59 +0200
committerGravatar synweap15 <shamdog+github@gmail.com> 2014-07-09 12:02:59 +0200
commit352301e4892d311d1a4cf6127f6bc70bc23eede3 (patch)
tree2e0b62b1d5377b257461f829ee072d9b29c5c5e9 /module/plugins/accounts/NoPremiumPl.py
parentremove enviroment line (diff)
downloadpyload-352301e4892d311d1a4cf6127f6bc70bc23eede3.tar.xz
remove blank lines and unused imports
Diffstat (limited to 'module/plugins/accounts/NoPremiumPl.py')
-rw-r--r--module/plugins/accounts/NoPremiumPl.py25
1 files changed, 7 insertions, 18 deletions
diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py
index df9e94a42..494b559c3 100644
--- a/module/plugins/accounts/NoPremiumPl.py
+++ b/module/plugins/accounts/NoPremiumPl.py
@@ -3,9 +3,7 @@
from datetime import datetime
from module.plugins.Account import Account
-from module.plugins.internal.SimpleHoster import parseHtmlForm
-import re
-from time import mktime, strptime
+from time import mktime
import module.lib.beaker.crypto as crypto
try:
@@ -13,6 +11,7 @@ try:
except ImportError:
from simplejson import loads
+
class NoPremiumPl(Account):
__name__ = "NoPremiumPl"
__version__ = "0.01"
@@ -37,38 +36,31 @@ class NoPremiumPl(Account):
_pwd = None
def loadAccountInfo(self, name, req):
-
self._req = req
-
try:
result = loads(self.runAuthQuery())
except:
- #todo: return or let it be thrown?
+ # todo: return or let it be thrown?
return
premium = False
valid_untill = -1
-
is_premium = "expire" in result.keys() and result["expire"] is not None
if is_premium:
-
premium = True
valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple())
-
traffic_left = result["balance"] * 1024
return ({
- "validuntil": valid_untill,
- "trafficleft": traffic_left,
- "premium": premium
- })
+ "validuntil": valid_untill,
+ "trafficleft": traffic_left,
+ "premium": premium
+ })
def login(self, user, data, req):
-
self._usr = user
self._pwd = crypto.sha1(crypto.md5(data["password"]).hexdigest()).hexdigest()
-
self._req = req
try:
@@ -78,12 +70,10 @@ class NoPremiumPl(Account):
if "errno" in response.keys():
self.wrongPassword()
-
data['usr'] = self._usr
data['pwd'] = self._pwd
def createAuthQuery(self):
-
query = self._api_query
query["username"] = self._usr
query["password"] = self._pwd
@@ -91,7 +81,6 @@ class NoPremiumPl(Account):
return query
def runAuthQuery(self):
-
data = self._req.load(self._api_url, post=self.createAuthQuery())
return data \ No newline at end of file