Botright icon indicating copy to clipboard operation
Botright copied to clipboard

[Question] Proxy documentation

Open cforcomputer opened this issue 1 year ago • 8 comments

Describe your question I've tried getting my proxy service to work with Botright. I have it working with a urllib example and with normal playwright. When I try to convert it to a string and use it in Botright, it does not connect. Can you please add a working example to the Botright documentation? `botright.modules.proxy_manager.ProxyCheckError: Could not get IP-Address of Proxy (Proxy is Invalid/Timed Out)

import asyncio
import botright


async def main():
    botright_client = await botright.Botright()

    # Proxy configuration
    proxy = "[username]:[password]@[address]:[port]"

    # Launch the browser with proxy settings
    browser = await botright_client.new_browser(
        proxy=proxy,
        args=[
            "--ignore-certificate-errors",
        ],
    )

    # Create a new page and navigate to the desired URL
    page = await browser.new_page()
    await page.goto("https://www.google.com")
    print(await page.title())

    await botright_client.close()


if __name__ == "__main__":
    asyncio.run(main())

Expected behavior Connects to proxy successfully.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Version 11

Additional context Adding http:// from the start does not change anything. Removing args does not change anything

cforcomputer avatar Jul 29 '24 10:07 cforcomputer

i got about:blank proxy not working

GJayLG avatar Aug 04 '24 09:08 GJayLG

in hostname:port:username:password format works

MarioCodarin avatar Aug 04 '24 11:08 MarioCodarin

image

GJayLG avatar Aug 04 '24 15:08 GJayLG

please provide minimal working code.

MarioCodarin avatar Aug 05 '24 17:08 MarioCodarin

anyone find a fix for this. Try to use a proxy and go to google but the page never loads. If I tab and search for it manually everything is working image_2024-11-09_171647448

cuppjj avatar Nov 09 '24 22:11 cuppjj

import asyncio import botright

async def main(): # Create botright client with specific options botright_client = await botright.Botright( use_undetected_playwright=True, # Set this to True if needed spoof_canvas=False, # Set to False if you don't want spoofing mask_fingerprint=False, # Set to False if you don't want fingerprint masking user_action_layer=True # Adjust user action layer behavior as per your needs )

# Proxy settings
hostname = '1'
port = '1'
username = '1'
password = '1'
proxy_settings = f'{username}:{password}@{hostname}:{port}'

# Launch a new browser with the proxy settings
browser = await botright_client.new_browser(proxy=proxy_settings)

# Create a new page
page = await browser.new_page()

# Navigate to Google
await page.goto("https://google.com")

# Close the botright client when done
await botright_client.close()

if name == "main": asyncio.run(main())

I tried this with my proxies and it always loads about:blank

cuppjj avatar Nov 09 '24 22:11 cuppjj

import asyncio import botright

async def main(): # Create botright client with specific options botright_client = await botright.Botright( use_undetected_playwright=True, # Set this to True if needed spoof_canvas=False, # Set to False if you don't want spoofing mask_fingerprint=False, # Set to False if you don't want fingerprint masking user_action_layer=True # Adjust user action layer behavior as per your needs )

# Proxy settings
hostname = '1'
port = '1'
username = '1'
password = '1'
proxy_settings = f'{username}:{password}@{hostname}:{port}'

# Launch a new browser with the proxy settings
browser = await botright_client.new_browser(proxy=proxy_settings)

# Create a new page
page = await browser.new_page()

# Navigate to Google
await page.goto("https://google.com")

# Close the botright client when done
await botright_client.close()

if name == "main": asyncio.run(main())

I tried this with my proxies and it always loads about:blank

I found a work around for anyone that needs it. If you go to a page that isnt google related like a card and middle mouse click the link the proxy will start to work

cuppjj avatar Nov 09 '24 23:11 cuppjj

maybe you need edit httpx code

        self._phttpx = httpx.AsyncClient(proxies={"all://": self.plain_proxy})

=> self._phttpx = httpx.AsyncClient(proxy=self.plain_proxy)

lower httpx version had not support

tisoz avatar Jul 07 '25 02:07 tisoz