From 6cd895b4ee930cc0d1ed21bf13f58804f49fb304 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:49:14 +0200 Subject: Create HighWayMe.py --- module/plugins/accounts/HighWayMe.py | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 module/plugins/accounts/HighWayMe.py (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py new file mode 100644 index 000000000..b192f6fa4 --- /dev/null +++ b/module/plugins/accounts/HighWayMe.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.Account import Account + + +class HighWayMe.py(Account): + __name__ = "HighWayMe.py" + __type__ = "account" + __version__ = "0.01" + + __description__ = """High-Way.Me account plugin""" + __license__ = "GPLv3" + __authors__ = [("yannik995", "evolutionclip@live.de")] + + + def loadAccountInfo(self, user, req): + premium = False + validuntil = -1 + trafficleft = None + + json_data = req.load('https://high-way.me/api.php?user') + + self.logDebug("JSON data: %s" % json_data) + + json_data = json_loads(json_data) + + if 'premium' in json_data['user'] and json_data['user']['premium']: + premium = True + + if 'premium_bis' in json_data['user'] and json_data['user']['premium_bis']: + validuntil = float(json_data['user']['premium_bis']) + + if 'premium_traffic' in json_data['user'] and json_data['user']['premium_traffic']: + trafficleft = float(json_data['user']['premium_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + + + def login(self, user, data, req): + + html = req.load("https://high-way.me/api.php?login", + post={'login': '1', 'user': user, 'pass': data['password']}, + decode=True) + + if 'UserOrPassInvalid' in html: + self.wrongPassword() -- cgit v1.2.3 From 0e2188958988b8e39e6b0d899a73aadfda11c2ef Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:50:43 +0200 Subject: Update HighWayMe.py --- module/plugins/accounts/HighWayMe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index b192f6fa4..76330a3d1 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -11,7 +11,7 @@ class HighWayMe.py(Account): __description__ = """High-Way.Me account plugin""" __license__ = "GPLv3" - __authors__ = [("yannik995", "evolutionclip@live.de")] + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3