Beispiel #1
0
import hmac
from http import cookies
import json
from typing import Callable, TYPE_CHECKING
from urllib.parse import urlencode

import thor
from thor.http import HttpClient, get_header
from thor.http.error import HttpError

from redbot.resource import HttpResource
from redbot.type import RawHeaderListType

token_client = HttpClient()
token_client.idle_timeout = 30
token_client.connect_timeout = 10
token_client.read_timeout = 10
token_client.max_server_conn = 30

if TYPE_CHECKING:
    from redbot.webui import RedWebUi  # pylint: disable=cyclic-import,unused-import


class CaptchaHandler:
    def __init__(
        self,
        webui: "RedWebUi",
        client_id: str,
        continue_test: Callable,
        error_response: Callable,
    ) -> None: