From ab22498f73ba6376d0242c4f0a706b312cf6cdb6 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 18 Aug 2010 22:39:07 +0200 Subject: account fixes --- module/plugins/accounts/HotfileCom.py | 43 +++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'module/plugins/accounts/HotfileCom.py') diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index af38b56a3..e6e8ba517 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -31,27 +31,30 @@ class HotfileCom(Account): __author_mail__ = ("mkaay@mkaay.de") def getAccountInfo(self, user): - req = self.core.requestFactory.getRequest(self.__name__, user) - - resp = self.apiCall("getuserinfo", user=user) - if resp.startswith("."): - self.core.debug("HotfileCom API Error: %s" % resp) - return None - info = {} - for p in resp.split("&"): - key, value = p.split("=") - info[key] = value + try: + req = self.core.requestFactory.getRequest(self.__name__, user) - info["premium_until"] = info["premium_until"].replace("T"," ") - zone = info["premium_until"][19:] - info["premium_until"] = info["premium_until"][:19] - zone = int(zone[:3]) - - validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":validuntil, "trafficleft":-1} - out.update(tmp) - return out + resp = self.apiCall("getuserinfo", user=user) + if resp.startswith("."): + self.core.debug("HotfileCom API Error: %s" % resp) + raise Exception + info = {} + for p in resp.split("&"): + key, value = p.split("=") + info[key] = value + + info["premium_until"] = info["premium_until"].replace("T"," ") + zone = info["premium_until"][19:] + info["premium_until"] = info["premium_until"][:19] + zone = int(zone[:3]) + + validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) + out = Account.getAccountInfo(self, user) + tmp = {"validuntil":validuntil, "trafficleft":-1} + out.update(tmp) + return out + except: + return Account.getAccountInfo(user) def apiCall(self, method, post={}, user=None): if user: -- cgit v1.2.3