How to use the cloudscraper.reCaptcha.reCaptcha function in cloudscraper

To help you get started, we’ve selected a few cloudscraper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VeNoMouS / cloudscraper / cloudscraper / reCaptcha / deathbycaptcha.py View on Github external
from __future__ import absolute_import

import json
import requests

try:
    import polling
except ImportError:
    import sys
    sys.tracebacklimit = 0
    raise RuntimeError("Please install the python module 'polling' via pip or download it from https://github.com/justiniso/polling/")

from . import reCaptcha


class captchaSolver(reCaptcha):

    def __init__(self):
        super(captchaSolver, self).__init__('deathbycaptcha')
        self.host = 'http://api.dbcapi.me/api'
        self.session = requests.Session()

        # ------------------------------------------------------------------------------- #

    @staticmethod
    def checkErrorStatus(response):
        errors = dict(
            [
                (400, "DeathByCaptcha: 400 Bad Request"),
                (403, "DeathByCaptcha: 403 Forbidden - Invalid credentails or insufficient credits."),
                # (500, "DeathByCaptcha: 500 Internal Server Error."),
                (503, "DeathByCaptcha: 503 Service Temporarily Unavailable.")
github VeNoMouS / cloudscraper / cloudscraper / reCaptcha / 2captcha.py View on Github external
from __future__ import absolute_import

import requests

try:
    import polling
except ImportError:
    import sys
    sys.tracebacklimit = 0
    raise RuntimeError("Please install the python module 'polling' via pip or download it from https://github.com/justiniso/polling/")

from . import reCaptcha


class captchaSolver(reCaptcha):

    def __init__(self):
        super(captchaSolver, self).__init__('2captcha')
        self.host = 'https://2captcha.com'
        self.session = requests.Session()

    # ------------------------------------------------------------------------------- #

    @staticmethod
    def checkErrorStatus(response, request_type):
        if response.status_code in [500, 502]:
            raise RuntimeError('2Captcha: Server Side Error {}'.format(response.status_code))

        errors = {
            'in.php': {
                "ERROR_WRONG_USER_KEY": "You've provided api_key parameter value is in incorrect format, it should contain 32 symbols.",
github VeNoMouS / cloudscraper / cloudscraper / reCaptcha / anticaptcha.py View on Github external
from __future__ import absolute_import

import sys

try:
    from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask
except ImportError:
    sys.tracebacklimit = 0
    raise RuntimeError("Please install the python module 'python_anticaptcha' via pip or download it from https://github.com/ad-m/python-anticaptcha")

from . import reCaptcha


class captchaSolver(reCaptcha):

    def __init__(self):
        super(captchaSolver, self).__init__('anticaptcha')

    def getCaptchaAnswer(self, site_url, site_key, reCaptchaParams):
        if not reCaptchaParams.get('api_key'):
            raise ValueError("reCaptcha provider 'anticaptcha' was not provided an 'api_key' parameter.")

        client = AnticaptchaClient(reCaptchaParams.get('api_key'))

        if reCaptchaParams.get('proxy'):
            client.session.proxies = reCaptchaParams.get('proxies')

        task = NoCaptchaTaskProxylessTask(site_url, site_key)

        if not hasattr(client, 'createTaskSmee'):