Closed i5513 closed 9 years ago
this looks like a reasonable request.
Please can you fork my repo and submit a PR. Also can you make sure that
little things like spaces after ,
are added to make the code conform
stylewise.
David
David Burns Email: david.burns@theautomatedtester.co.uk URL: http://www.theautomatedtester.co.uk/
On Mon, Sep 22, 2014 at 11:28 PM, i5513 notifications@github.com wrote:
Hello,
I would like to propose to support starting a new proxy configured to use a http proxy. At https://github.com/lightbody/browsermob-proxy we can see , that we can : [~]$ curl -X POST http://localhost:9090/proxy?httpProxy=yourproxyserver.com:8080 {"port":9091}
I propose the next simple patch:
diff --git a/browsermobproxy/client.py b/browsermobproxy/client.py index 20827f3..f9302e4 100644 --- a/browsermobproxy/client.py +++ b/browsermobproxy/client.py @@ -4,15 +4,17 @@ import json
class Client(object):
- def init(self, url):
def init(self, url,params={}): """ Initialises a new Client object
:param url: This is where the BrowserMob Proxy lives
- :param params: URL query (for example httpProxy and httpsProxy vars) """ self.host = "http://" + url
- resp = requests.post('%s/proxy' % self.host, urlencode(''))
- urlparams="?"+urlencode(params) if params else ""
resp = requests.post('%s/proxy' % self.host + urlparams) jcontent = json.loads(resp.content) self.port = jcontent['port'] url_parts = self.host.split(":")
diff --git a/browsermobproxy/server.py b/browsermobproxy/server.py index 7857a06..e8e8e37 100644 --- a/browsermobproxy/server.py +++ b/browsermobproxy/server.py @@ -85,12 +85,14 @@ class Server(object): """ return "http://localhost:%d" % self.port
- def create_proxy(self):
- def create_proxy(self,params={}): """ Gets a client class that allow to set all the proxy details that you may need to.
- :param params: Dictionary where you can specify params \
- like httpProxy and httpsProxy """
- client = Client(self.url[7:])
client = Client(self.url[7:],params) return client
def _is_listening(self):
If you prefer I fork and make a pull request, please tell me ( I think it is better that smaller changes like this is ok with a patch inline a comment)
Do you think it is appropiate to include in your next release?
Thanks
— Reply to this email directly or view it on GitHub https://github.com/AutomatedTester/browsermob-proxy-py/issues/27.
If I understand correctly, with this change I can add a proxy connection to BMP, like this:
PythonCode + Selenium --> BMP --> External Proxy --> The Internet
I tried using the Server.create_proxy({'httpProxy' : "
Is my problem or BMP isn't connecting to the proxy ?
PD. Also is a private proxy and I pass the header that I need: proxy.headers({'Proxy-Authorization':'blahblahblah'}).
Hello, Joseph, since I made the push request I did not test / use browsermob proxy. My proxy was working, but it did not need any authorization nor autenticación. So I dont know if it is supported
Regards
Hello,
I would like to propose to support starting a new proxy configured to use a http proxy. At https://github.com/lightbody/browsermob-proxy we can see , that we can : [~]$ curl -X POST http://localhost:9090/proxy?httpProxy=yourproxyserver.com:8080 {"port":9091}
I propose the next simple patch:
If you prefer I fork and make a pull request, please tell me ( I think it is better that smaller changes like this is ok with a patch inline a comment)
Do you think it is appropiate to include in your next release?
Thanks