summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RapidgatorNet.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
commitf5535809bebc6cc343475704832c8fd8674d2d06 (patch)
treec59bc1e6d71c04f5545ea262056c0c5be1bd8910 /module/plugins/accounts/RapidgatorNet.py
parentFixed PEP 8 violations in Hosters (diff)
downloadpyload-f5535809bebc6cc343475704832c8fd8674d2d06.tar.xz
Fixed PEP 8 violations in Accounts
Diffstat (limited to 'module/plugins/accounts/RapidgatorNet.py')
-rw-r--r--module/plugins/accounts/RapidgatorNet.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py
index 85adc71a3..8a02b712c 100644
--- a/module/plugins/accounts/RapidgatorNet.py
+++ b/module/plugins/accounts/RapidgatorNet.py
@@ -17,11 +17,10 @@
@author: zoidberg
"""
-import re
from module.plugins.Account import Account
-from module.utils import parseFileSize
from module.common.json_layer import json_loads
+
class RapidgatorNet(Account):
__name__ = "RapidgatorNet"
__version__ = "0.04"
@@ -29,24 +28,24 @@ class RapidgatorNet(Account):
__description__ = """rapidgator.net account plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
API_URL = 'http://rapidgator.net/api/user'
-
+
def loadAccountInfo(self, user, req):
try:
- sid = self.getAccountData(user).get('SID')
+ sid = self.getAccountData(user).get('SID')
assert sid
-
+
json = req.load("%s/info?sid=%s" % (self.API_URL, sid))
- self.logDebug("API:USERINFO", json)
+ self.logDebug("API:USERINFO", json)
json = json_loads(json)
-
+
if json['response_status'] == 200:
if "reset_in" in json['response']:
self.scheduleRefresh(user, json['response']['reset_in'])
-
- return {"validuntil": json['response']['expire_date'],
- "trafficleft": int(json['response']['traffic_left']) / 1024,
+
+ return {"validuntil": json['response']['expire_date'],
+ "trafficleft": int(json['response']['traffic_left']) / 1024,
"premium": True}
else:
self.logError(json['response_details'])
@@ -54,21 +53,19 @@ class RapidgatorNet(Account):
self.logError(e)
return {"validuntil": None, "trafficleft": None, "premium": False}
-
- def login(self, user, data, req):
+
+ def login(self, user, data, req):
try:
- json = req.load('%s/login' % self.API_URL,
- post = {"username": user,
- "password": data['password']})
+ json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']})
self.logDebug("API:LOGIN", json)
- json = json_loads(json)
-
+ json = json_loads(json)
+
if json['response_status'] == 200:
data['SID'] = str(json['response']['session_id'])
- return
+ return
else:
self.logError(json['response_details'])
except Exception, e:
self.logError(e)
-
+
self.wrongPassword()