Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Passing parameters to request.get #132

Closed
migueleliasweb opened this issue Jul 20, 2016 · 2 comments
Closed

[Question] Passing parameters to request.get #132

migueleliasweb opened this issue Jul 20, 2016 · 2 comments

Comments

@migueleliasweb
Copy link
Contributor

Here in the company where I work we can only access the marathon api through a proxy, but sadly I cannot pass any extra parameter to requests.session.

A simple workaround would be to implement an additional argument that could be passed on the class initialization with extra parameters, something like:

class MarathonClient(object):

    """Client interface for the Marathon REST API."""

    def __init__(self, servers, username=None, password=None, timeout=10, requests_extra_args={}):
        #some ommited code
        self.requests_extra_args = requests_extra_args

     def _do_request(self, method, path, params=None, data=None):
        """Query Marathon server."""
        headers = {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        }

        headers.update(self.requests_extra_args)

What do you think ? Does this worth a PR ?

@solarkennedy
Copy link
Contributor

Can you set HTTP_PROXY instead?
http://docs.python-requests.org/en/master/user/advanced/#proxies

@migueleliasweb
Copy link
Contributor Author

That actually worked just fine !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants