From 08ae63b3f1faccabb58fe2fddf5ec41d684b201e Mon Sep 17 00:00:00 2001 From: gotlium Date: Tue, 12 Jan 2016 21:19:29 +0500 Subject: [PATCH] Smells fixes --- antigate/__init__.py | 1 + antigate/backends/grab_lib.py | 7 ++++--- antigate/backends/requests_lib.py | 2 +- antigate/backends/urllib_lib.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/antigate/__init__.py b/antigate/__init__.py index 4e376b8..dcf0149 100644 --- a/antigate/__init__.py +++ b/antigate/__init__.py @@ -177,6 +177,7 @@ def send(self, captcha_file): msg = exc_info()[1] if str(msg) != 'ERROR_NO_SLOT_AVAILABLE': raise AntiGateError(msg) + sleep(0.5) def get(self, captcha_id=None): self.logger.debug('Fetching result') diff --git a/antigate/backends/grab_lib.py b/antigate/backends/grab_lib.py index a07ad5c..ab1b54e 100644 --- a/antigate/backends/grab_lib.py +++ b/antigate/backends/grab_lib.py @@ -17,10 +17,11 @@ def request(self, url): self.grab.go(url) return self.grab.response.code, self.get_response_body() - def setup(self, *args, **kwargs): - self.grab.setup(*args, **kwargs) + def setup(self, **kwargs): + self.grab.setup(**kwargs) - def upload(self, filename): + @staticmethod + def upload(filename): return UploadFile(filename) def reset(self): diff --git a/antigate/backends/requests_lib.py b/antigate/backends/requests_lib.py index 561e3f1..704f92c 100644 --- a/antigate/backends/requests_lib.py +++ b/antigate/backends/requests_lib.py @@ -34,7 +34,7 @@ def request(self, url): self.r = requests.get(url, **self.config) return self.r.status_code, self.r.text - def setup(self, *args, **kwargs): + def setup(self, **kwargs): self.conf.update(kwargs) @staticmethod diff --git a/antigate/backends/urllib_lib.py b/antigate/backends/urllib_lib.py index cf5bdb7..84409cb 100644 --- a/antigate/backends/urllib_lib.py +++ b/antigate/backends/urllib_lib.py @@ -48,7 +48,7 @@ def request(self, url): self.r = self.u.read() return self.u.getcode(), self.r - def setup(self, *args, **kwargs): + def setup(self, **kwargs): self.conf.update(kwargs) @staticmethod