Skip to content

Commit

Permalink
Merge pull request #200 from AndreiDrang/master
Browse files Browse the repository at this point in the history
Updated enum docs
  • Loading branch information
AndreiDrang authored Dec 14, 2023
2 parents 6d3dfd6 + dce109f commit 7a176ab
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 64 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
env:
RUCAPTCHA_KEY: ${{ secrets.RUCAPTCHA_KEY }}
DEATHBYCAPTCHA_KEY: ${{ secrets.DEATHBYCAPTCHA_KEY }}
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_COVERAGE_ID }}
strategy:
fail-fast: false
matrix:
Expand All @@ -50,6 +51,11 @@ jobs:
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: /home/runner/work/python-rucaptcha/python-rucaptcha/coverage/coverage.xml
files: ${{github.workspace}}/coverage/coverage.xml
fail_ci_if_error: true
verbose: true

- name: Upload coverage to Code Climate
uses: paambaati/[email protected]
with:
coverageLocations: ${{github.workspace}}/coverage/coverage.xml:coverage.py
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"sphinx.ext.napoleon",
"pallets_sphinx_themes",
"sphinxcontrib.autodoc_pydantic",
"enum_tools.autoenum",
)
myst_enable_extensions = ["deflist"]
intersphinx_mapping = {"python": ("https://docs.python.org/3.10/", None)}
Expand Down
69 changes: 23 additions & 46 deletions docs/modules/enum/info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,71 @@ To import this module:
from python_rucaptcha.core import enums
.. autoclass:: python_rucaptcha.core.enums.MyEnum
.. autoenum:: python_rucaptcha.core.enums.MyEnum
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.ServiceEnm
.. autoenum:: python_rucaptcha.core.enums.ServiceEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.SaveFormatsEnm
.. autoenum:: python_rucaptcha.core.enums.SaveFormatsEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.GeetestEnm
.. autoenum:: python_rucaptcha.core.enums.GeetestEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.ImageCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.ImageCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.CapyPuzzleEnm
.. autoenum:: python_rucaptcha.core.enums.CapyPuzzleEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.FunCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.FunCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.ReCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.ReCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.LeminCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.LeminCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.HCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.HCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.KeyCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.KeyCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.RotateCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.RotateCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.ControlEnm
.. autoenum:: python_rucaptcha.core.enums.ControlEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.TurnstileCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.TurnstileCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.AmazonWAFCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.AmazonWAFCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.CutCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.CutCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.DataDomeSliderEnm
.. autoenum:: python_rucaptcha.core.enums.DataDomeSliderEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.CyberSiARAEnm
.. autoenum:: python_rucaptcha.core.enums.CyberSiARAEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.MTCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.MTCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.BoundingBoxCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.BoundingBoxCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.DrawAroundCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.DrawAroundCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.CoordinatesCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.CoordinatesCaptchaEnm
:members:
:undoc-members:

.. autoclass:: python_rucaptcha.core.enums.GridCaptchaEnm
.. autoenum:: python_rucaptcha.core.enums.GridCaptchaEnm
:members:
:undoc-members:
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ myst-parser==2.0.0
autodoc_pydantic==2.0.1
pydantic==2.5.2
pydantic-settings==2.1.0
enum-tools[sphinx]==0.11.0
12 changes: 5 additions & 7 deletions src/python_rucaptcha/core/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ class TaskSer(MyBaseModel):
type: str


class ErrorFieldsSer(Struct):
errorCode: str = None
errorDescription: str = None


class CreateTaskBaseSer(MyBaseModel):
clientKey: str
task: TaskSer = {}
Expand Down Expand Up @@ -62,8 +57,7 @@ def urls_set(self):
"""


class GetTaskResultResponseSer(MyBaseModel, ErrorFieldsSer):
errorId: int = 0
class GetTaskResultResponseSer(MyBaseModel):
status: str = "ready"
solution: dict = None
cost: float = None
Expand All @@ -74,3 +68,7 @@ class GetTaskResultResponseSer(MyBaseModel, ErrorFieldsSer):
taskId: int = None
# control method params
balance: float = None
# error info
errorId: int = 0
errorCode: str = None
errorDescription: str = None
12 changes: 2 additions & 10 deletions src/python_rucaptcha/gee_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,7 @@ def captcha_handler(self, challenge: str, **kwargs) -> dict:
Notes:
Check class docstirng for more info
"""
if self.method == GeetestEnm.GeeTestTaskProxyless.value:
if challenge is not None:
self.create_task_payload["task"].update({"challenge": challenge})
else:
raise ValueError(f"For {self.method} challenge is required")
self.create_task_payload["task"].update({"challenge": challenge})

return self._processing_response(**kwargs)

Expand All @@ -215,10 +211,6 @@ async def aio_captcha_handler(self, challenge: str) -> dict:
Notes:
Check class docstirng for more info
"""
if self.method == GeetestEnm.GeeTestTaskProxyless.value:
if challenge is not None:
self.create_task_payload["task"].update({"challenge": challenge})
else:
raise ValueError(f"For {self.method} challenge is required")
self.create_task_payload["task"].update({"challenge": challenge})

return await self._aio_processing_response()

0 comments on commit 7a176ab

Please sign in to comment.