Python scrapy.exceptions() Examples

The following are 1 code examples of scrapy.exceptions(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scrapy , or try the search function .
Example #1
Source File: spiders.py    From autologin with Apache License 2.0 5 votes vote down vote up
def solve_captcha(self, page_form):
        from decaptcha.exceptions import DecaptchaError
        form_screenshot = b64decode(page_form['screenshot'])
        self.save_screenshot('captcha', form_screenshot)
        try:
            captcha_value = yield self.solver.solve(form_screenshot)
        except DecaptchaError as e:
            self.logger.error('captcha not solved', exc=e)
            returnValue(None)
        else:
            self.logger.info('captcha solved: "%s"' % captcha_value)
            self.attempted_captchas.append(form_screenshot)
            returnValue(captcha_value)