summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RPNetBiz.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-09-29 20:05:07 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-09-29 20:05:07 +0200
commitec6e5dc7fcdcefee10e37d22473c9accae1104cf (patch)
treed19824c0223b083d5b4256530443165cfabb7a04 /module/plugins/accounts/RPNetBiz.py
parentMerge pull request #1850 from chaosblog/patch-2 (diff)
downloadpyload-ec6e5dc7fcdcefee10e37d22473c9accae1104cf.tar.xz
Account class completely rewritten + plugins updated
Diffstat (limited to 'module/plugins/accounts/RPNetBiz.py')
-rw-r--r--module/plugins/accounts/RPNetBiz.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py
index f973ea4cd..2d2a7fba0 100644
--- a/module/plugins/accounts/RPNetBiz.py
+++ b/module/plugins/accounts/RPNetBiz.py
@@ -7,7 +7,7 @@ from module.common.json_layer import json_loads
class RPNetBiz(Account):
__name__ = "RPNetBiz"
__type__ = "account"
- __version__ = "0.16"
+ __version__ = "0.17"
__status__ = "testing"
__description__ = """RPNet.biz account plugin"""
@@ -15,9 +15,24 @@ class RPNetBiz(Account):
__authors__ = [("Dman", "dmanugm@gmail.com")]
- def grab_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={'username': user,
+ 'password': password,
+ 'action' : "showHosterList"})
+ hoster_list = json_loads(res)
+
+ #: If account is not valid thera are no hosters available
+ if 'error' in hoster_list:
+ return []
+
+ #: Extract hosters from json file
+ return hoster_list['hosters']
+
+
+ def grab_info(self, user, password, data):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, password, req)
+ res = self.get_account_status(user, password)
try:
if res['accountInfo']['isPremium']:
#: Parse account info. Change the trafficleft later to support per host info.
@@ -33,16 +48,16 @@ class RPNetBiz(Account):
return account_info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, password, req)
+ res = self.get_account_status(user, password)
#: If we have an error in the res, we have wrong login information
if 'error' in res:
self.fail_login()
- def get_account_status(self, user, password, req):
+ def get_account_status(self, user, password):
#: Using the rpnet API, check if valid premium account
res = self.load("https://premium.rpnet.biz/client_api.php",
get={'username': user, 'password': password,