Skip to content

Commit f132fa3

Browse files
fix: changes the captcha_type condition because with the or condition… (#59)
* 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>
1 parent 1320507 commit f132fa3

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

capmonster_python/capmonster.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def report_incorrect_captcha(self, captcha_type: str, task_id: int) -> bool:
7373
:return: True if the captcha is successfully reported, False otherwise.
7474
:raises CapmonsterException: If the captcha type is invalid.
7575
"""
76-
if captcha_type != "image" or "token":
76+
valid_captcha_types = ["image", "token"]
77+
78+
if captcha_type not in valid_captcha_types:
7779
raise CapmonsterException(
7880
1, "ERROR_INCORRECT_CAPTCHA_TYPE", "Valid captcha_type parameters are only 'image' or 'token'.")
7981
try:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name="capmonster_python",
10-
version="2.6.1",
10+
version="2.6.2",
1111
packages=["capmonster_python"],
1212
url="https://github.com/alperensert/capmonster_python",
1313
long_description=long_description,

0 commit comments

Comments
 (0)