Skip to content

Commit

Permalink
add optional proxy parameter
Browse files Browse the repository at this point in the history
optional proxy parameter for explicit proxy settings divergent to the system
settings
  • Loading branch information
chaosblog committed Feb 6, 2013
1 parent 42a2545 commit 7e278d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autojenkins/jobs.py
Expand Up @@ -50,10 +50,11 @@ def _validate(response):
class Jenkins(object):
"""Main class to interact with a Jenkins server."""

def __init__(self, base_url, auth=None, verify_ssl_cert=True):
def __init__(self, base_url, auth=None, verify_ssl_cert=True, proxies={}):
self.ROOT = base_url
self.auth = auth
self.verify_ssl_cert = verify_ssl_cert
self.proxies = proxies

def _url(self, command, *args):
"""
Expand All @@ -76,6 +77,7 @@ def _http_get(self, url, **kwargs):
response = requests.get(url,
auth=self.auth,
verify=self.verify_ssl_cert,
proxies=self.proxies,
**kwargs)
return _validate(response)

Expand All @@ -88,6 +90,7 @@ def _http_post(self, url, **kwargs):
response = requests.post(url,
auth=self.auth,
verify=self.verify_ssl_cert,
proxies=self.proxies,
**kwargs)
return _validate(response)

Expand Down

0 comments on commit 7e278d3

Please sign in to comment.