From deb0f20ecdb706c0740831d8f3839908bd3d5f9a Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 25 Mar 2020 19:50:57 +0100 Subject: [PATCH] ops --- lib/cloudscraper/exceptions.py | 99 ++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 lib/cloudscraper/exceptions.py diff --git a/lib/cloudscraper/exceptions.py b/lib/cloudscraper/exceptions.py new file mode 100644 index 00000000..77ccbc75 --- /dev/null +++ b/lib/cloudscraper/exceptions.py @@ -0,0 +1,99 @@ +# -*- 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 CloudflareReCaptchaError(CloudflareException): + """ + Raise an error for problem extracting reCaptcha paramters + from Cloudflare payload + """ + + +class CloudflareReCaptchaProvider(CloudflareException): + """ + Raise an exception for no reCaptcha provider loaded for Cloudflare. + """ + +# ------------------------------------------------------------------------------- # + + +class reCaptchaException(Exception): + """ + Base exception class for cloudscraper reCaptcha Providers + """ + + +class reCaptchaServiceUnavailable(reCaptchaException): + """ + Raise an exception for external services that cannot be reached + """ + + +class reCaptchaAPIError(reCaptchaException): + """ + Raise an error for error from API response. + """ + + +class reCaptchaAccountError(reCaptchaException): + """ + Raise an error for reCaptcha provider account problem. + """ + + +class reCaptchaTimeout(reCaptchaException): + """ + Raise an exception for reCaptcha provider taking too long. + """ + + +class reCaptchaParameter(reCaptchaException): + """ + Raise an exception for bad or missing Parameter. + """ + + +class reCaptchaBadJobID(reCaptchaException): + """ + Raise an exception for invalid job id. + """ + + +class reCaptchaReportError(reCaptchaException): + """ + Raise an error for reCaptcha provider unable to report bad solve. + """