opn-sonarqube-api


Nameopn-sonarqube-api JSON
Version 2.3.3.3089652 PyPI version JSON
download
home_page
SummaryOpen SonarQube API Handler
upload_time2023-06-26 07:33:41
maintainer
docs_urlNone
authoropen sas
requires_python
licenseMIT
keywords api sonar sonarqube
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ====================
Python SonarQube API
====================

.. image:: https://img.shields.io/github/license/kako-nawao/python-sonarqube-api.svg
    :target: http://www.opensource.org/licenses/MIT

.. image:: https://img.shields.io/pypi/pyversions/sonarqube-api.svg
    :target: https://pypi.python.org/pypi/sonarqube-api
.. image:: https://img.shields.io/pypi/v/sonarqube-api.svg
    :target: https://pypi.python.org/pypi/sonarqube-api

.. image:: https://img.shields.io/travis/kako-nawao/python-sonarqube-api.svg
    :target: https://travis-ci.org/kako-nawao/python-sonarqube-api
.. image:: https://img.shields.io/codecov/c/github/kako-nawao/python-sonarqube-api.svg
    :target: https://codecov.io/gh/kako-nawao/python-sonarqube-api

API Handler for SonarQube web service, providing basic authentication (which
seems to be the only kind that SonarQube supports) and a few methods to run sonarqube API.

Installation
============

Install from PyPI::

    pip install opn-sonarqube-api

Compatibility
-------------

This package is compatible Python versions 2.7, 3.4, 3.5 and 3.6.
Probably others, but those are the ones against which we build (by Travis CI).


Usage
=====

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.

Example getting projects with coverage and issues metrics::

    from sonarqube_api.sonar import SonarAPI

    h = SonarAPI(user='admin', password='admin')
    for project in h.get_resources_full_data(metrics=['coverage', 'violations']):
        # 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.

You can also specify a single resources to fetch, but keep in mind that the resource methods
return generators, so you still need to *get the next object*::

    proj = next(h.get_resources_full_data(resource='some:example'))

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 = SonarAPI(token='f052f55b127bb06f63c31cb2064ea301048d9e5d')

Supported Methods
-----------------

The methods supported by the SonarAPI are:

* ``activate_rule``: activate a rule for a given profile in the server
* ``create_rule``: create a rule in the server
* ``get_metrics``: yield metrics definition
* ``get_rules``: yield active rules
* ``get_resources_debt``: yield projects with their technical debt by category
* ``get_resources_metrics``: yield projects with some general metrics
* ``get_resources_full_data``: yield projects with their general metrics and technical debt by category (merge of previous two methods)
* ``validate_authentication``: validate authentication credentials

* ``create_group``
* ``search_group``
* ``update_group``
* ``delete_group``

* ``create_permission_template``
* ``update_permission_template``
* ``search_permission_template``
* ``delete_permission_template``

* ``add_group_to_template``
* ``list_groups_of_template``
* ``remove_group_from_template``

* ``add_permission_to_user``
* ``remove_permission_to_user``
* ``add_permission_to_group``
* ``remove_permission_to_group``
* ``search_permission_for_group``

* ``generate_token``
* ``revoke_token``
* ``user_tokens``
* ``user_current``

* ``get_metrics``

* ``restore_quality_profile_from_xml``
* ``create_quality_profile``
* ``add_project_to_quality_profile``
* ``delete_quality_profile``

* ``activate_rule``
* ``get_resources_debt``
* ``get_resources_metrics``
* ``create_rule``
* ``get_rules``
* ``get_resources_full_data``

* ``setting``
* ``getting``

* ``list_qualitygates``
* ``show_qualitygates``
* ``create_qualitygates``
* ``destroy_qualitygates``
* ``create_condition_qualitygates``
* ``create_quality_gate_from_json``
* ``delete_condition_qualitygates``
* ``update_condition_qualitygates``





            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "opn-sonarqube-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "api sonar sonarqube",
    "author": "open sas",
    "author_email": "boost-support@open-groupe.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/68/57c6e8183bb202c84c75beb504d6bba92a4a2fc8737880b5aff337af1250/opn_sonarqube_api-2.3.3.3089652.tar.gz",
    "platform": null,
    "description": "====================\nPython SonarQube API\n====================\n\n.. image:: https://img.shields.io/github/license/kako-nawao/python-sonarqube-api.svg\n    :target: http://www.opensource.org/licenses/MIT\n\n.. image:: https://img.shields.io/pypi/pyversions/sonarqube-api.svg\n    :target: https://pypi.python.org/pypi/sonarqube-api\n.. image:: https://img.shields.io/pypi/v/sonarqube-api.svg\n    :target: https://pypi.python.org/pypi/sonarqube-api\n\n.. image:: https://img.shields.io/travis/kako-nawao/python-sonarqube-api.svg\n    :target: https://travis-ci.org/kako-nawao/python-sonarqube-api\n.. image:: https://img.shields.io/codecov/c/github/kako-nawao/python-sonarqube-api.svg\n    :target: https://codecov.io/gh/kako-nawao/python-sonarqube-api\n\nAPI Handler for SonarQube web service, providing basic authentication (which\nseems to be the only kind that SonarQube supports) and a few methods to run sonarqube API.\n\nInstallation\n============\n\nInstall from PyPI::\n\n    pip install opn-sonarqube-api\n\nCompatibility\n-------------\n\nThis package is compatible Python versions 2.7, 3.4, 3.5 and 3.6.\nProbably others, but those are the ones against which we build (by Travis CI).\n\n\nUsage\n=====\n\nThe API handler is easy to use, you just need to initialize it with the\nconnection parameters (by default *localhost* on port *9000* without\nauthentication) and use any of the methods to get the required information or\ncreate rules.\n\nExample getting projects with coverage and issues metrics::\n\n    from sonarqube_api.sonar import SonarAPI\n\n    h = SonarAPI(user='admin', password='admin')\n    for project in h.get_resources_full_data(metrics=['coverage', 'violations']):\n        # do something with project data...\n\nSince the actual response data from SonarQube server is usually paged, all\nmethods return generators to optimize memory as well retrieval performance of\nthe first items.\n\nYou can also specify a single resources to fetch, but keep in mind that the resource methods\nreturn generators, so you still need to *get the next object*::\n\n    proj = next(h.get_resources_full_data(resource='some:example'))\n\nSonar authentication tokens can also be used in place of username and password,\nwhich is particularly useful when accessing the SonarQube API from a CI server,\nas tokens can easily be revoked in the event of unintended exposure::\n\n    h = SonarAPI(token='f052f55b127bb06f63c31cb2064ea301048d9e5d')\n\nSupported Methods\n-----------------\n\nThe methods supported by the SonarAPI are:\n\n* ``activate_rule``: activate a rule for a given profile in the server\n* ``create_rule``: create a rule in the server\n* ``get_metrics``: yield metrics definition\n* ``get_rules``: yield active rules\n* ``get_resources_debt``: yield projects with their technical debt by category\n* ``get_resources_metrics``: yield projects with some general metrics\n* ``get_resources_full_data``: yield projects with their general metrics and technical debt by category (merge of previous two methods)\n* ``validate_authentication``: validate authentication credentials\n\n* ``create_group``\n* ``search_group``\n* ``update_group``\n* ``delete_group``\n\n* ``create_permission_template``\n* ``update_permission_template``\n* ``search_permission_template``\n* ``delete_permission_template``\n\n* ``add_group_to_template``\n* ``list_groups_of_template``\n* ``remove_group_from_template``\n\n* ``add_permission_to_user``\n* ``remove_permission_to_user``\n* ``add_permission_to_group``\n* ``remove_permission_to_group``\n* ``search_permission_for_group``\n\n* ``generate_token``\n* ``revoke_token``\n* ``user_tokens``\n* ``user_current``\n\n* ``get_metrics``\n\n* ``restore_quality_profile_from_xml``\n* ``create_quality_profile``\n* ``add_project_to_quality_profile``\n* ``delete_quality_profile``\n\n* ``activate_rule``\n* ``get_resources_debt``\n* ``get_resources_metrics``\n* ``create_rule``\n* ``get_rules``\n* ``get_resources_full_data``\n\n* ``setting``\n* ``getting``\n\n* ``list_qualitygates``\n* ``show_qualitygates``\n* ``create_qualitygates``\n* ``destroy_qualitygates``\n* ``create_condition_qualitygates``\n* ``create_quality_gate_from_json``\n* ``delete_condition_qualitygates``\n* ``update_condition_qualitygates``\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Open SonarQube API Handler",
    "version": "2.3.3.3089652",
    "project_urls": null,
    "split_keywords": [
        "api",
        "sonar",
        "sonarqube"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e731ebc37a0c75749983709a20817526eba863dde67178ac0d55b0e4d107fcd6",
                "md5": "86f60db5ae74bd03a53fae8a57d223ce",
                "sha256": "498401bab7d4ec4fd6f3d57ec535275a795a7b049a6757560ecc0257e803967c"
            },
            "downloads": -1,
            "filename": "opn_sonarqube_api-2.3.3.3089652-py2-none-any.whl",
            "has_sig": false,
            "md5_digest": "86f60db5ae74bd03a53fae8a57d223ce",
            "packagetype": "bdist_wheel",
            "python_version": "py2",
            "requires_python": null,
            "size": 28249,
            "upload_time": "2023-06-26T07:33:39",
            "upload_time_iso_8601": "2023-06-26T07:33:39.565958Z",
            "url": "https://files.pythonhosted.org/packages/e7/31/ebc37a0c75749983709a20817526eba863dde67178ac0d55b0e4d107fcd6/opn_sonarqube_api-2.3.3.3089652-py2-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b26857c6e8183bb202c84c75beb504d6bba92a4a2fc8737880b5aff337af1250",
                "md5": "078cb2a8ed4c2844c094cd63750e8d3f",
                "sha256": "d79a9ddfb30947601371dd5832ad4e8ba17789f4567714157277688f4f758e48"
            },
            "downloads": -1,
            "filename": "opn_sonarqube_api-2.3.3.3089652.tar.gz",
            "has_sig": false,
            "md5_digest": "078cb2a8ed4c2844c094cd63750e8d3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21901,
            "upload_time": "2023-06-26T07:33:41",
            "upload_time_iso_8601": "2023-06-26T07:33:41.223178Z",
            "url": "https://files.pythonhosted.org/packages/b2/68/57c6e8183bb202c84c75beb504d6bba92a4a2fc8737880b5aff337af1250/opn_sonarqube_api-2.3.3.3089652.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-26 07:33:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "opn-sonarqube-api"
}
        
Elapsed time: 0.08042s