Updates from cloudscraper 1.2.58

This commit is contained in:
Jim Miller 2021-04-09 20:54:39 -05:00
parent f139e6ea94
commit a757d97a40

View file

@ -58,7 +58,7 @@ from .user_agent import User_Agent
# ------------------------------------------------------------------------------- # # ------------------------------------------------------------------------------- #
__version__ = '1.2.56py2' __version__ = '1.2.58py2'
# ------------------------------------------------------------------------------- # # ------------------------------------------------------------------------------- #
@ -197,7 +197,7 @@ class CloudScraper(Session):
@staticmethod @staticmethod
def debugRequest(req): def debugRequest(req):
try: try:
print(dump.dump_all(req).decode('utf-8')) print(dump.dump_all(req).decode('utf-8', errors='backslashreplace'))
except ValueError as e: except ValueError as e:
print("Debug Error: {}".format(getattr(e, 'message', e))) print("Debug Error: {}".format(getattr(e, 'message', e)))
@ -355,7 +355,7 @@ class CloudScraper(Session):
resp.headers.get('Server', '').startswith('cloudflare') resp.headers.get('Server', '').startswith('cloudflare')
and resp.status_code in [429, 503] and resp.status_code in [429, 503]
and re.search( and re.search(
r'cpo.src\s*=\s*"/cdn-cgi/challenge-platform/\S+orchestrate/jsch/v1"', r'cpo.src\s*=\s*"/cdn-cgi/challenge-platform/\S+orchestrate/jsch/v1',
resp.text, resp.text,
re.M | re.S re.M | re.S
) )
@ -376,7 +376,7 @@ class CloudScraper(Session):
return ( return (
CloudScraper.is_Captcha_Challenge(resp) CloudScraper.is_Captcha_Challenge(resp)
and re.search( and re.search(
r'cpo.src\s*=\s*"/cdn-cgi/challenge-platform/\S+orchestrate/captcha/v1"', r'cpo.src\s*=\s*"/cdn-cgi/challenge-platform/\S+orchestrate/captcha/v1',
resp.text, resp.text,
re.M | re.S re.M | re.S
) )