Code Monkey home page Code Monkey logo

Comments (3)

AutomatedTester avatar AutomatedTester commented on July 18, 2024

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: [email protected]
URL: http://www.theautomatedtester.co.uk/

On Mon, Sep 22, 2014 at 11:28 PM, i5513 [email protected] 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
#27.

from browsermob-proxy-py.

JosephCastro avatar JosephCastro commented on July 18, 2024

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' : ":", 'httpsProxy' : ":"}), then I tried loading a WhereIsMyIpService (http://www.whereisip.net), and still stay in my country :(

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'}).

from browsermob-proxy-py.

i5513 avatar i5513 commented on July 18, 2024

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

from browsermob-proxy-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.