Reputation: 1
I am using a Mac and installed the required files from bmp.lightbody.net, and unzipped them. I tried creating a Server in my Python file using the following code.
server = Server('/Users/username/Downloads/browsermob-proxy-2.1.4/bin/browsermob-proxy')
I was met with the following error
browsermobproxy.exceptions.ProxyServerError: Browsermob-Proxy binary couldn't be found in path provided: /Users/username/Downloads/browsermob-proxy-2.1.4/bin/browsermob-proxy
The path runs perfectly in my Terminal, and I was able to create a proxy.
curl -X POST localhost:8080/proxy
{"port":8081}
I have also tried appending the folder to my path using sys
and moving the browsermob folder to the folder where the python file is present, but nothing seems to work.
Any help would be welcome. Thanks!
Upvotes: 0
Views: 2725
Reputation: 13400
I had the same issue on Windows, here what worked for me:
import requests
from browsermobproxy import Server
import time
# Start the BrowserMob Proxy server
server = Server(r"D:\browsermob-proxy-2.1.4\bin\browsermob-proxy.bat")
server.start()
proxy = server.create_proxy()
Upvotes: 0
Reputation: 295
Similar question
Try to add the actual directory to the PATH
echo 'export PATH=$PATH:/Users/username/Downloads/browsermob-proxy-2.1.4/bin' >> ~/.bashrc
This way you don't have to specify the path arg on the Server instance manually
from browsermobproxy import Server
dict = {'port': 8090}
server = Server(options=dict)
Upvotes: 0