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 77 forks source link

missing `organisation` parameter for some api calls #6

Closed mikomraz closed 4 years ago

mikomraz commented 4 years ago

Hello @shijl-0925 👋

Thank you for the great work! It is a handy python library to deal with Sonar's api.

I would like to raise an issue I noticed: for some api, there the field organisation is required, and there is no way to pass it. For example: https://sonarcloud.io/web_api/api/rules/tags?query=rules

GET api/rules/tags

>>> list(sonar.rules.get_rule(rule_key=rule))
sonarqube.exceptions.ValidationError: Error in request. Possibly validation error [400]: The 'organization' parameter is missing

and some, even though documentation says "optional" it is still needed, like in GET api/rules/search:

>>> list(sonar.rules.search_rules(q=rule))
sonarqube.exceptions.ValidationError: Error in request. Possibly validation error [400]: The 'organization' parameter is missing

Besides adding the missing parameters, maybe it's possible to allow extra ones? or add organization as part of session?

Thank you very much!

shijl0925 commented 4 years ago

python-sonarqube-api >=1.1.3 support SonarCloud APIs. please use The latest installation package。

from sonarqube import SonarCloudClient h = SonarCloudClient(sonarcloud_url="https://sonarcloud.io", token='*****')