summaryrefslogtreecommitdiffhomepage
path: root/libs/cloudscraper/exceptions.py
blob: 1ed0b2367eca877259617834c7fc96d2b305bd01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# -*- coding: utf-8 -*-

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

"""
cloudscraper.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of cloudscraper exceptions.
"""

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


class CloudflareException(Exception):
    """
    Base exception class for cloudscraper for Cloudflare
    """


class CloudflareLoopProtection(CloudflareException):
    """
    Raise an exception for recursive depth protection
    """


class CloudflareCode1020(CloudflareException):
    """
    Raise an exception for Cloudflare code 1020 block
    """


class CloudflareIUAMError(CloudflareException):
    """
    Raise an error for problem extracting IUAM paramters
    from Cloudflare payload
    """


class CloudflareChallengeError(CloudflareException):
    """
    Raise an error when detected new Cloudflare challenge
    """


class CloudflareSolveError(CloudflareException):
    """
    Raise an error when issue with solving Cloudflare challenge
    """


class CloudflareCaptchaError(CloudflareException):
    """
    Raise an error for problem extracting Captcha paramters
    from Cloudflare payload
    """


class CloudflareCaptchaProvider(CloudflareException):
    """
    Raise an exception for no Captcha provider loaded for Cloudflare.
    """

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


class CaptchaException(Exception):
    """
    Base exception class for cloudscraper captcha Providers
    """


class CaptchaServiceUnavailable(CaptchaException):
    """
    Raise an exception for external services that cannot be reached
    """


class CaptchaAPIError(CaptchaException):
    """
    Raise an error for error from API response.
    """


class CaptchaAccountError(CaptchaException):
    """
    Raise an error for captcha provider account problem.
    """


class CaptchaTimeout(CaptchaException):
    """
    Raise an exception for captcha provider taking too long.
    """


class CaptchaParameter(CaptchaException):
    """
    Raise an exception for bad or missing Parameter.
    """


class CaptchaBadJobID(CaptchaException):
    """
    Raise an exception for invalid job id.
    """


class CaptchaReportError(CaptchaException):
    """
    Raise an error for captcha provider unable to report bad solve.
    """