From ff9383bfe06d14d23bc0ed6af79aa8967965d078 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 10:59:52 +0200 Subject: Code cosmetics (3) --- module/plugins/hooks/BypassCaptcha.py | 6 +++--- module/plugins/hooks/CaptchaBrotherhood.py | 8 ++++---- module/plugins/hooks/Checksum.py | 4 ++-- module/plugins/hooks/DeathByCaptcha.py | 6 +++--- module/plugins/hooks/ExpertDecoders.py | 2 +- module/plugins/hooks/FreeWayMeHook.py | 2 +- module/plugins/hooks/IRCInterface.py | 12 ++++++------ module/plugins/hooks/ImageTyperz.py | 2 +- module/plugins/hooks/SmoozedComHook.py | 2 +- module/plugins/hooks/XMPPInterface.py | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 2607ac5ad..8a47da5bd 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -48,7 +48,7 @@ class BypassCaptcha(Hook): def get_credits(self): - res = self.load(self.GETCREDITS_URL, post={"key": self.get_config('passkey')}) + res = self.load(self.GETCREDITS_URL, post={'key': self.get_config('passkey')}) data = dict(x.split(' ', 1) for x in res.splitlines()) return int(data['Left']) @@ -83,8 +83,8 @@ class BypassCaptcha(Hook): def respond(self, ticket, success): try: - res = self.load(self.RESPOND_URL, post={"task_id": ticket, "key": self.get_config('passkey'), - "cv": 1 if success else 0}) + res = self.load(self.RESPOND_URL, post={'task_id': ticket, 'key': self.get_config('passkey'), + 'cv': 1 if success else 0}) except BadHeader, e: self.log_error(_("Could not send response"), e) diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1265fc0ae..1660e2059 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -55,7 +55,7 @@ class CaptchaBrotherhood(Hook): def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={"username": self.get_config('username'), "password": self.get_config('password')}) + get={'username': self.get_config('username'), 'password': self.get_config('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -118,9 +118,9 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), - get={"username": self.get_config('username'), - "password": self.get_config('password'), - "captchaID": ticket}) + get={'username': self.get_config('username'), + 'password': self.get_config('password'), + 'captchaID': ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 681816a0f..29263a180 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -80,8 +80,8 @@ class Checksum(Addon): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. pyfile.plugin.check_data should be a dictionary which can contain: - a) if known, the exact filesize in bytes (e.g. "size": 123456789) - b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307") + a) if known, the exact filesize in bytes (e.g. 'size': 123456789) + b) hexadecimal hash string with algorithm name as key (e.g. 'md5': "d76505d0869f9f928a17d42d66326307") """ if hasattr(pyfile.plugin, "check_data") and isinstance(pyfile.plugin.check_data, dict): data = pyfile.plugin.check_data.copy() diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 6727107ca..699243ddc 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -73,8 +73,8 @@ class DeathByCaptcha(Hook): if post: if not isinstance(post, dict): post = {} - post.update({"username": self.get_config('username'), - "password": self.get_config('password')}) + post.update({'username': self.get_config('username'), + 'password': self.get_config('password')}) res = None try: @@ -138,7 +138,7 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - res = self.api_response("captcha", {"captchafile": data}, multipart) + res = self.api_response("captcha", {'captchafile': data}, multipart) if "captcha" not in res: raise DeathByCaptchaException(res) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index baf880644..ac1b223df 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -30,7 +30,7 @@ class ExpertDecoders(Hook): def get_credits(self): - res = self.load(self.API_URL, post={"key": self.get_config('passkey'), "action": "balance"}) + res = self.load(self.API_URL, post={'key': self.get_config('passkey'), 'action': "balance"}) if res.isdigit(): self.log_info(_("%s credits left") % res) diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py index 48af011d4..a55b6bb93 100644 --- a/module/plugins/hooks/FreeWayMeHook.py +++ b/module/plugins/hooks/FreeWayMeHook.py @@ -20,5 +20,5 @@ class FreeWayMeHook(MultiHook): def get_hosters(self): user, data = self.account.select_account() - hostis = self.load("http://www.free-way.bz/ajax/jd.php", get={"id": 3, "user": user, "pass": data['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 + hostis = self.load("http://www.free-way.bz/ajax/jd.php", get={'id': 3, 'user': user, 'pass': data['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index e31435e96..732340e3e 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -62,7 +62,7 @@ class IRCInterface(Thread, Addon): try: if self.get_config('info_file'): self.response( - _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname}) + _("Download finished: %(name)s @ %(plugin)s ") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) except Exception: pass @@ -73,7 +73,7 @@ class IRCInterface(Thread, Addon): task.setWaiting(60) html = self.load("http://www.freeimagehosting.net/upload.php", - post={"attached": (pycurl.FORM_FILE, task.captchaFile)}) + post={'attached': (pycurl.FORM_FILE, task.captchaFile)}) url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", html).group(1) self.response(_("New Captcha Request: %s") % url) @@ -136,10 +136,10 @@ class IRCInterface(Thread, Addon): continue msg = { - "origin": msg[0][1:], - "action": msg[1], - "target": msg[2], - "text": msg[3][1:] + 'origin': msg[0][1:], + 'action': msg[1], + 'target': msg[2], + 'text': msg[3][1:] } self.handle_events(msg) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 2e4cae903..9687819a3 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -86,7 +86,7 @@ class ImageTyperz(Hook): res = self.load(self.SUBMIT_URL, post={'action': "UPLOADCAPTCHA", 'username': self.get_config('username'), - 'password': self.get_config('password'), "file": data}, + 'password': self.get_config('password'), 'file': data}, multipart=multipart, req=req) finally: diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py index 2d4fb564e..733fd642a 100644 --- a/module/plugins/hooks/SmoozedComHook.py +++ b/module/plugins/hooks/SmoozedComHook.py @@ -20,4 +20,4 @@ class SmoozedComHook(MultiHook): def get_hosters(self): user, data = self.account.select_account() - return self.account.get_account_info(user)["hosters"] + return self.account.get_account_info(user)['hosters'] diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 4262d3034..5eee3b872 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -77,7 +77,7 @@ class XMPPInterface(IRCInterface, JabberClient): try: if self.get_config('info_file'): self.announce( - _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname}) + _("Download finished: %(name)s @ %(plugin)s") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) except Exception: pass -- cgit v1.2.3