A python client for SonarQube
ℹ️
|
This project is still a WIP and will have missing features |
The API handler is easy to use, you just need to initialize it with the connection parameters (by default localhost on port 9000 without authentication) and use any of the methods to get the required information or create rules.
from sonarqube import SonarQubeAPI
h = SonarQubeClient(user='admin', password='admin')
for project in h.projects:
# do something with project data...
Since the actual response data from SonarQube server is usually paged, all methods return generators to optimize memory as well retrieval performance of the first items.
Sonar authentication tokens can also be used in place of username and password, which is particularly useful when accessing the SonarQube API from a CI server, as tokens can easily be revoked in the event of unintended exposure::
h = SonarQubeClient(token='<TOKEN>')