Closed fz0000 closed 3 years ago
Here is an example from my code(my real code is for https but no much difference):
import os from browsermobproxy import Server from selenium import webdriver from selenium.webdriver import DesiredCapabilities p_server = 'xxx.xxx.xxx.xxx:8888' p_user = '<username>' p_password = '<password>' server = Server(os.path.realpath('browsermob-proxy-2.1.4/bin/browsermob-proxy.bat')) server.start() params = {'trustAllServers': True, 'httpProxy': p_server} client = server.create_proxy(params=params) client.basic_authentication('', p_user, p_password) # return code 404 here capabilities = DesiredCapabilities.FIREFOX client.add_to_capabilities(capabilities) options = webdriver.FirefoxOptions() options.accept_insecure_certs = True driver = webdriver.Firefox(capabilities=capabilities, options=options) driver.get('http://www.example.com') # # some other code here
And error occurs after go to the url:
It seems that my username and password are not set via the method basic_authentication and it always use the default account.
basic_authentication
Or, is there any error in my code? Any example will be appreciated!
Windows 10 x64 BrowserMob Proxy 2.1.4 Firefox 84.0 python 3.8.6 with:
It seems to be a browsermob-proxy doc issue. The REST API needs update. and so do the client.py and readme.md here...
client.py
readme.md
Here is an example from my code(my real code is for https but no much difference):
And error occurs after go to the url:
It seems that my username and password are not set via the method
basic_authentication
and it always use the default account.Or, is there any error in my code? Any example will be appreciated!
Environment
Windows 10 x64 BrowserMob Proxy 2.1.4 Firefox 84.0 python 3.8.6 with: