shijl0925 / python-sonarqube-api

Python Client library for interacting with Community, Developer, and Enterprise Editions SonarQube's REST APIs and SonarCloud's REST APIs.
https://python-sonarqube-pro-api.readthedocs.io/en/latest/
GNU Affero General Public License v3.0
133 stars 76 forks source link

sonar API request behind a proxy #101

Open erable2 opened 3 months ago

erable2 commented 3 months ago

Hi,

I'm trying to make a request to Sonar API behind the proxy of my company but i can't make it work.

I tried this :

os.environ["HTTPS_PROXY"] = "proxy_url:8080"

sonar = SonarQubeClient(sonarqube_url="https://sonar_url/", token="****")

projects = sonar.projects.search_projects()
print("projects: {}".format(projects))

I got this result : requests.exceptions.ProxyError: HTTPSConnectionPool(host='sonar_url', port=443): Max retries exceeded with url: /liferay/sonar/api/projects/search?onProvisionedOnly=false&qualifiers=TRK (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 badgateway')))

Is there a way to define proxy settings in a SonarQube client ?