summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/PremiumTo.py
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
commit844dfd92f590e531ca2f7fd86305fcbc13a03721 (patch)
tree5303bd07749b362dab071ada6197fe37dda85b27 /module/plugins/accounts/PremiumTo.py
parent[BitshareCom] Code cosmetics (diff)
parent[SimpleHoster] Fix DB error (diff)
downloadpyload-844dfd92f590e531ca2f7fd86305fcbc13a03721.tar.xz
Merge pull request #1 from pyload/stable
sync stable
Diffstat (limited to 'module/plugins/accounts/PremiumTo.py')
-rw-r--r--module/plugins/accounts/PremiumTo.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py
index efc64706b..c8ea2fa26 100644
--- a/module/plugins/accounts/PremiumTo.py
+++ b/module/plugins/accounts/PremiumTo.py
@@ -6,7 +6,7 @@ from module.plugins.Account import Account
class PremiumTo(Account):
__name__ = "PremiumTo"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.08"
__description__ = """Premium.to account plugin"""
__license__ = "GPLv3"
@@ -16,19 +16,22 @@ class PremiumTo(Account):
def loadAccountInfo(self, user, req):
- api_r = req.load("http://premium.to/api/straffic.php",
- get={'username': self.username, 'password': self.password})
+ traffic = req.load("http://premium.to/api/straffic.php",
+ get={'username': self.username, 'password': self.password})
- trafficleft = float(sum(map(int, api_r.split(';')))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
-
- return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1}
+ if "wrong username" not in traffic:
+ trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
+ return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1}
+ else:
+ return {'premium': False, 'trafficleft': None, 'validuntil': None}
def login(self, user, data, req):
self.username = user
self.password = data['password']
authcode = req.load("http://premium.to/api/getauthcode.php",
- get={'username': user, 'password': self.password}).strip()
+ get={'username': user, 'password': self.password},
+ decode=True)
if "wrong username" in authcode:
self.wrongPassword()