diff options
Diffstat (limited to 'module/plugins/accounts/RPNetBiz.py')
-rw-r--r-- | module/plugins/accounts/RPNetBiz.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 49a294d14..813453c03 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -5,20 +5,22 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): - __name__ = "RPNetBiz" - __version__ = "0.1" - __type__ = "account" + __name__ = "RPNetBiz" + __type__ = "account" + __version__ = "0.11" + __description__ = """RPNet.biz account plugin""" - __author_name__ = "Dman" - __author_mail__ = "dmanugm@gmail.com" + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] + def loadAccountInfo(self, user, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) try: - if response['accountInfo']['isPremium']: + if res['accountInfo']['isPremium']: # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(response['accountInfo']['premiumExpiry']), + account_info = {"validuntil": float(res['accountInfo']['premiumExpiry']), "trafficleft": -1, "premium": True} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} @@ -29,19 +31,21 @@ class RPNetBiz(Account): return account_info + def login(self, user, data, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) - # If we have an error in the response, we have wrong login information - if 'error' in response: + # If we have an error in the res, we have wrong login information + if 'error' in res: self.wrongPassword() + def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account - response = req.load("https://premium.rpnet.biz/client_api.php", + res = req.load("https://premium.rpnet.biz/client_api.php", get={"username": user, "password": self.accounts[user]['password'], "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % response) + self.logDebug("JSON data: %s" % res) - return json_loads(response) + return json_loads(res) |