Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] offline tests fail #130

Open
kaliiiiiiiiii opened this issue Sep 22, 2024 · 0 comments
Open

[BUG] offline tests fail #130

kaliiiiiiiiii opened this issue Sep 22, 2024 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@kaliiiiiiiiii
Copy link

kaliiiiiiiiii commented Sep 22, 2024

Botright should not depend on being online for tests wich do not require an internet connection

Example exception:

tests\test_playwright.py:95 (test_canvas_botright)
@pytest.mark.asyncio
    async def test_canvas_botright():
        botright_client = await botright.Botright(use_undetected_playwright=True, user_action_layer=True)
        try:
>           browser = await botright_client.new_browser(channel="chrome")

tests\test_playwright.py:100: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\lib\site-packages\botright\botright.py:147: in new_browser
    _proxy: ProxyManager = await ProxyManager(self, proxy)
.venv\lib\site-packages\async_class.py:173: in __await__
    yield from self.create_task(
.venv\lib\site-packages\botright\modules\proxy_manager.py:68: in __ainit__
    await self.check_proxy(self._phttpx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <botright.modules.proxy_manager.ProxyManager object at 0x00000245FA3CEE80>
httpx_client = <httpx.AsyncClient object at 0x00000245FA316B90>

    async def check_proxy(self, httpx_client: httpx.AsyncClient) -> None:
        """
        Check the validity of the proxy by making HTTP requests to determine its properties.
    
        Args:
            httpx_client (httpx.AsyncClient): The HTTPX client to use for proxy checks.
        """
        get_ip_apis = ["https://api.ipify.org/?format=json", "https://api.myip.com/", "https://get.geojs.io/v1/ip.json", "https://api.ip.sb/jsonip", "https://l2.io/ip.json"]
    
        for get_ip_api in get_ip_apis:
            try:
                ip_request = await httpx_client.get(get_ip_api, timeout=self.timeout)
                ip = ip_request.json().get("ip")
                break
            except Exception:
                pass
        else:
>           raise ProxyCheckError("Could not get IP-Address of Proxy (Proxy is Invalid/Timed Out)")
E           botright.modules.proxy_manager.ProxyCheckError: Could not get IP-Address of Proxy (Proxy is Invalid/Timed Out)

.venv\lib\site-packages\botright\modules\proxy_manager.py:123: ProxyCheckError

@kaliiiiiiiiii kaliiiiiiiiii added bug Something isn't working help wanted Extra attention is needed labels Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant