Skip to content

Commit

Permalink
fix: changes the captcha_type condition because with the or condition… (
Browse files Browse the repository at this point in the history
#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 <[email protected]>
  • Loading branch information
rodrigozavan and alperensert authored Mar 9, 2024
1 parent 1320507 commit f132fa3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion capmonster_python/capmonster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f132fa3

Please sign in to comment.