Registry / http-networking / browsermob-proxy

browsermob-proxy

JSON →
library0.8.0pypypi✓ verified 84d ago

A Python client library for interacting with the Browsermob Proxy, used for capturing HTTP/HTTPS traffic in HAR format. Current version 0.8.0, last released in 2015, now in maintenance mode.

pip install browsermob-proxy
INSTALL
IMPORT
SIG · BROWSERMOB-PROXY
B
browsermob-proxy
http-networkingpythonv0.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Server
from browsermobproxy import Server
import browsermobproxy.Server
Incorrect: 'browsermobproxy.Server' is not a module; use from ... import syntax
Client
from browsermobproxy import Client

Start Browsermob Proxy, integrate with Selenium, capture HAR data.

from browsermobproxy import Server from selenium import webdriver # Start Browsermob Proxy server server = Server('/path/to/browsermob-proxy') server.start() proxy = server.create_proxy() # Configure Selenium to use proxy from selenium.webdriver.common.proxy import Proxy, ProxyType selenium_proxy = Proxy() selenium_proxy.proxy_type = ProxyType.MANUAL selenium_proxy.http_proxy = proxy.proxy selenium_proxy.ssl_proxy = proxy.proxy capabilities = webdriver.DesiredCapabilities.CHROME proxy.add_to_capabilities(capabilities) driver = webdriver.Chrome(desired_capabilities=capabilities) # Enable HAR capture proxy.new_har('test') driver.get('http://example.com') # Get HAR data har = proxy.har print(har) # Cleanup driver.quit() server.stop()
Debug
Known issues
deprecatedLibrary is unmaintained since 2015. Browsermob Proxy itself has been discontinued. Consider migrating to BrowserUp Proxy (browserup-proxy) which is the actively maintained fork.
fix
Use browserup-proxy Python package instead: pip install browserup-proxy and update import to 'from browserup_proxy import Server'
affects: >=0.8.0
gotchaThe library requires a running Browsermob Proxy Java binary. It does not start the proxy automatically; you must provide the path to the browsermob-proxy executable or use the local=True flag for it to download and start a local instance (only works if the binary is not present).
fix
Ensure the Browsermob Proxy binary is installed or use the 'local=True' parameter in Server() to auto-download (may fail on some systems).
affects: all
gotchaThe 'create_proxy' method may return a Client object that uses requests.Session; if you close the session prematurely, subsequent calls fail. Always use proxy.close() to clean up.
fix
Call proxy.close() after finishing, not client.session.close().
affects: all
Errors
Common errors & fixes
browsermobproxy.exceptions.ProxyNotFoundError: The browsermob proxy executable was not found. Please specify the path to the executable.
The library cannot find the Browsermob Proxy binary. Either the path is incorrect or the binary is not installed.
fix
Provide correct path to 'browsermob-proxy' binary: Server('/usr/local/bin/browsermob-proxy') or set PATH.
AttributeError: module 'browsermobproxy' has no attribute 'Server'
Incorrect import statement; often from copy-paste of wrong syntax.
fix
Use 'from browsermobproxy import Server'
Upgrade
Version history
0.8.0latest on PyPI · released Feb 7, 2017
Audit
Dependencies
requestsrequiredHTTP client for API calls to Browsermob Proxy REST API
seleniumoptionalOften used together for browser automation with proxy integration
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
browsermob-proxy — pip install browsermob-proxy · libregistry