From f132fa33e825e026ab3b5a1346f4775eb6373deb Mon Sep 17 00:00:00 2001 From: rodrigozavan <57202442+rodrigozavan@users.noreply.github.com> Date: Sat, 9 Mar 2024 07:56:55 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20changes=20the=20captcha=5Ftype=20conditi?= =?UTF-8?q?on=20because=20with=20the=20or=20condition=E2=80=A6=20(#59)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: changes the captcha_type condition because with the or condition it will always fall into the exception The previous condition if captcha_type != "image" or "token": was wrong because regardless of what I passed in the captcha_type it will always enter the condition because it is checking if the captcha_type is different from "image" or if the string " token " is true and because it is a string with value it will always fall into the condition * Update version to 2.6.2 in setup.py --------- Co-authored-by: alperensert <63921520+alperensert@users.noreply.github.com> --- capmonster_python/capmonster.py | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/capmonster_python/capmonster.py b/capmonster_python/capmonster.py index 1c8c5bd..6436fb5 100644 --- a/capmonster_python/capmonster.py +++ b/capmonster_python/capmonster.py @@ -73,7 +73,9 @@ def report_incorrect_captcha(self, captcha_type: str, task_id: int) -> bool: :return: True if the captcha is successfully reported, False otherwise. :raises CapmonsterException: If the captcha type is invalid. """ - if captcha_type != "image" or "token": + valid_captcha_types = ["image", "token"] + + if captcha_type not in valid_captcha_types: raise CapmonsterException( 1, "ERROR_INCORRECT_CAPTCHA_TYPE", "Valid captcha_type parameters are only 'image' or 'token'.") try: diff --git a/setup.py b/setup.py index e5b292b..08cac30 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="capmonster_python", - version="2.6.1", + version="2.6.2", packages=["capmonster_python"], url="https://github.com/alperensert/capmonster_python", long_description=long_description,