Skip to content

Conversation

@Monsterovich
Copy link
Contributor

@Monsterovich Monsterovich commented Jun 17, 2025

It appears that deepl has blocked access from the Russian Federation.

How to use:

dl = deepl.DeepLCLI("en", "ru", proxy={ "server": "socks5://yourproxy:port", "username": "user", "password": "pass" })
..the rest of the code

@Monsterovich Monsterovich force-pushed the feat-proxy branch 5 times, most recently from 3c719e4 to a01b7b1 Compare June 17, 2025 23:20
@Monsterovich

This comment was marked as outdated.

@Monsterovich
Copy link
Contributor Author

Hello @eggplants !

I updated this MR, and I also removed the code that was preventing the translation from being received.

@Monsterovich Monsterovich changed the title Added proxy field Added proxy field and fix interaction with DOM Dec 28, 2025
@eggplants
Copy link
Owner

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds proxy support to enable access to DeepL from regions where it may be blocked, and refines DOM interaction by replacing problematic cookie/extension toast handling with direct HTTP response checking.

  • Added proxy parameter support using Playwright's ProxySettings type
  • Replaced cookie banner and extension toast handling with HTTP response validation
  • Enhanced error handling for page load failures with status code reporting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Owner

@eggplants eggplants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Monsterovich Please confirm to pass the tests by running mise run pytest in your local environment.

@Monsterovich
Copy link
Contributor Author

@Monsterovich Please confirm to pass the tests by running mise run pytest in your local environment.

HTTPS_PROXY=proxy python3 -m pytest
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /home/monsterovich/Distfiles/compile/deepl-cli
plugins: anyio-4.11.0
collected 11 items                                                                                                                                                                                                                          

tests/test_deepl.py ......sssss                                                                                                                                                                                                       [100%]

============================================================================================================= warnings summary ==============================================================================================================
tests/test_deepl.py:60
  /home/monsterovich/Distfiles/compile/deepl-cli/tests/test_deepl.py:60: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
    @pytest.mark.asyncio

tests/test_deepl.py:67
  /home/monsterovich/Distfiles/compile/deepl-cli/tests/test_deepl.py:67: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
    @pytest.mark.asyncio

tests/test_deepl.py::test_translate_async
tests/test_deepl.py::test_translate_async_long_text
  /usr/lib/python3/dist-packages/_pytest/python.py:172: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
  You need to install a suitable plugin for your async framework, for example:
    - anyio
    - pytest-asyncio
    - pytest-tornasync
    - pytest-trio
    - pytest-twisted
    warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================================================= 6 passed, 5 skipped, 4 warnings in 13.51s =================================================================================================

@eggplants eggplants merged commit fb392c0 into eggplants:master Dec 29, 2025
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants