BrowserMob Proxy
https://browsermob-proxy-py.readthedocs.io/en/stable/
Welcome to BrowserMob Proxy’s documentation! — BrowserMob Proxy 0.6.0 documentation
Docs » Welcome to BrowserMob Proxy’s documentation! Edit on GitHub Welcome to BrowserMob Proxy’s documentation! Python client for the BrowserMob Proxy 2.0 REST API. How to install BrowserMob Proxy is available on PyPI, so you can install it with pip:
browsermob-proxy-py.readthedocs.io
https://github.com/lightbody/browsermob-proxy
GitHub - lightbody/browsermob-proxy: A free utility to help web developers watch and manipulate network traffic from their AJAX
A free utility to help web developers watch and manipulate network traffic from their AJAX applications. - GitHub - lightbody/browsermob-proxy: A free utility to help web developers watch and manip...
github.com
import settings
from browsermobproxy import Server
from selenium.webdriver import DesiredCapabilities
config = settings.Config
server = Server(config.BROWSERMOB_PATH)
server.start()
proxy = server.create_proxy()
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % proxy.proxy)
chrome_options.add_argument('--headless')
capabilities = DesiredCapabilities.CHROME.copy()
capabilities['acceptSslCerts'] = True
capabilities['acceptInsecureCerts'] = True
driver = webdriver.Chrome(options=chrome_options,
desired_capabilities=capabilities,
executable_path=config.CHROME_PATH)
proxy.new_har("sahibinden", options={'captureHeaders': True})
driver.get("https://www.sahibinden.com/en")
entries = proxy.har['log']["entries"]
for entry in entries:
if 'request' in entry.keys():
print(entry['request']['url'])
print(entry['request']['headers'])
print('\n')
proxy.close()
driver.quit()