ClericPy / ichrome

Chrome controller for Humans, based on Chrome Devtools Protocol(CDP) and python3.7+.
https://pypi.org/project/ichrome/
MIT License
227 stars 29 forks source link

How do I connect to a proxy with ichrome? #130

Closed juanfrilla closed 1 year ago

juanfrilla commented 1 year ago

i'm trying to connect to a proxy like this, but not able to do it:

    async def navigate_ichrome(self, doc_id):
        proxy = "103.152.112.145:80"
        chrome_path = "/usr/bin/chromium-browser" if not _DEV_MODE else None
        async with AsyncChromeDaemon(
            headless=True, proxy=proxy, chrome_path=chrome_path
        ) as cd:
            async with cd.connect_tab() as tab:
                await tab.goto(self.origin + "/document/" + doc_id, timeout=60000)
                sleep(30)
                html = await tab.html
                return Soup(html, "html.parser")
ClericPy commented 1 year ago
  1. use http proxy: http://103.152.112.145:80
  2. Linux chromium try async with cd.incognito_tab(proxyServer=proxy) as tab:
  3. test proxy with http://httpbbin.org/ip
juanfrilla commented 1 year ago

Amazing, now It worked