[Question] Proxy documentation
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
i got about:blank proxy not working
in hostname:port:username:password format works
please provide minimal working code.
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
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
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
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