From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/hooks/DeathByCaptcha.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/DeathByCaptcha.py') diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index f7bc1b90f..5a5ab7933 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: mkaay, RaNaN, zoidberg """ from __future__ import with_statement @@ -62,16 +60,20 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" __version__ = "0.03" - __description__ = """Send captchas to DeathByCaptcha.com""" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", False), ("username", "str", "Username", ""), ("passkey", "password", "Password", ""), ("force", "bool", "Force DBC even if client is connected", False)] + + __description__ = """Send captchas to DeathByCaptcha.com""" __author_name__ = ("RaNaN", "zoidberg") __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz") API_URL = "http://api.dbcapi.me/api/" + def setup(self): self.info = {} -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hooks/DeathByCaptcha.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/DeathByCaptcha.py') diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 5a5ab7933..64ed2280f 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -183,7 +183,7 @@ class DeathByCaptcha(Hook): self.logError(e.getDesc()) return False - balance, rate = self.info["balance"], self.info["rate"] + balance, rate = self.info['balance'], self.info['rate'] self.logInfo("Account balance: US$%.3f (%d captchas left at %.2f cents each)" % (balance / 100, balance // rate, rate)) @@ -196,7 +196,7 @@ class DeathByCaptcha(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - response = self.call_api("captcha/%d/report" % task.data["ticket"], True) + response = self.call_api("captcha/%d/report" % task.data['ticket'], True) except DeathByCaptchaException, e: self.logError(e.getDesc()) except Exception, e: @@ -211,5 +211,5 @@ class DeathByCaptcha(Hook): self.logError(e.getDesc()) return - task.data["ticket"] = ticket + task.data['ticket'] = ticket task.setResult(result) -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hooks/DeathByCaptcha.py | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'module/plugins/hooks/DeathByCaptcha.py') diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 64ed2280f..530395d32 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -1,31 +1,18 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" from __future__ import with_statement -from thread import start_new_thread +import re + +from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER +from thread import start_new_thread from time import sleep -from base64 import b64encode -import re -from module.network.RequestFactory import getRequest +from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader +from module.network.RequestFactory import getRequest from module.plugins.Hook import Hook -from module.common.json_layer import json_loads class DeathByCaptchaException(Exception): @@ -59,8 +46,8 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" - __version__ = "0.03" __type__ = "hook" + __version__ = "0.03" __config__ = [("activated", "bool", "Activated", False), ("username", "str", "Username", ""), @@ -134,7 +121,7 @@ class DeathByCaptcha(Hook): raise DeathByCaptchaException('service-overload') def submit(self, captcha, captchaType="file", match=None): - #workaround multipart-post bug in HTTPRequest.py + #workaround multipart-post bug in HTTPRequest.py if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) -- cgit v1.2.3