pycontribs / jenkinsapi

A Python API for accessing resources and configuring Hudson & Jenkins continuous-integration servers
http://pypi.python.org/pypi/jenkinsapi
MIT License
858 stars 485 forks source link

[feature_parameters] jenkins object connection parameters #828

Open JayChanggithub opened 2 years ago

JayChanggithub commented 2 years ago

Hi Support,

i wanna to adopt proxies parameter when i create Jenkins object. Because of our jenkins instance need through proxies to connect. Have anything possible to do these like below sample code ? i saw the source code cannot input additional parameters like proxies. If so how to do? Thanks

from jenkinsapi.jenkins import Jenkins
proxies = {
   'http': 'http://tunnel-http-proxy.pipeline-tunnel:8080'
}

jenkinsClient = Jenkins(
    url,
    username=username,
    password=password,
    ssl_verify=False,
    max_retries=30,
    timeout=120,
    proxies=proxies
)
vetsin commented 1 year ago

Since i looked here first, i'll post how I worked around this:

import jenkinsapi, urllib

server = jenkinsapi.jenkins.Jenkins(server_uri, username=username, password=password)
server.requester.session.proxies = urllib.request.getproxies()
pbelskiy commented 10 months ago

Any updates?

@vetsin Yes it should work, but you patch private variable, so it could not work in future.