{ "info": { "author": "Claudio Omar Melendrez Baeza", "author_email": "claudio.melendrez@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development" ], "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 fetch\nmetrics and rules, as well as methods to create rules and (soon) profiles.\n\nInstallation\n============\n\nInstall from PyPI::\n\n pip install 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 import SonarAPIHandler\n\n h = SonarAPIHandler(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 = SonarAPIHandler(token='f052f55b127bb06f63c31cb2064ea301048d9e5d')\n\nSupported Methods\n-----------------\n\nThe methods supported by the SonarAPIHandler 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\nCommands\n--------\n\nThe package also provides a few commands you can use from the shell to export\nor migrate rules in SonarQube servers.\n\nExport Rules\n~~~~~~~~~~~~\n\nThe command ``export-sonarqube-rules`` reads the rules in a SonarQube server and\ncreates two files with their data. One is a *csv* with a snapshot of the rule\n(including key, name, status, etc) and the other one is an *html* with all\nthe information, including description and examples.\n\nThe command uses sensible defaults, so the following::\n\n export-sonarqube-rules\n\nWill export all rules on the server running at *localhost:9000* into the files\n*rules.csv* and *rules.html* on your home directory.\n\nBut you can change the host, authentication, or filter the rules with a number\nof available options::\n\n export-sonarqube-rules --host=http://sonar.example.com --user=admin --active-only --languages=py,js\n\nFor the complete set of export options run::\n\n export-sonarqube-rules -h\n\nActivate Rules\n~~~~~~~~~~~~~~\n\nThe command ``activate-sonarqube-rules`` reads an input csv file and activates\nthe rules on a SonarQube server for a quality profile, according to the\ndefinitions on the file.\n\nThe command requires a profile key and a file name::\n\n activate-sonarqube-rules py-test-18349 active-rules.csv\n\nAs usual, you can customize all the server connection parameters, which you can\nview with the help command::\n\n activate-sonarqube-rules -h\n\nThe file can be very simple: the only required field in the file is *key* (for\nthe rule key), but you can also define the *severity* and customize **any**\nparameter such as *xpathQuery*, *message*, *format*... anything at all. You\ncan also use *reset* (which takes values *true*/*yes*) to force using defaults\nfor all values--for which rule all other params will be ignored.\n\nMigrate Rules\n~~~~~~~~~~~~~\n\nThe command ``migrate-sonarqube-rules`` reads the custom rules in a SonarQube\nserver (the source) and tries to recreate them in another SonarQube server\n(the target). Since by default it uses *localhost* for both source and target,\nyou'll need to specify at least one of the hosts.\n\nFor example, to copy all custom rules defined in server *sonar.from.com* to\nserver *sonar.to.com*, you would execute::\n\n migrate-sonarqube-rules --source-host=http://sonar.from.com --target-host=http://sonar.to.com\n\nAs with the previous command, you can specify all the connection options\n(``--source-port``, ``--target-port``, ``--source-user``, etc).\n\nFor the complete set of export options run::\n\n migrate-sonarqube-rules -h\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kako-nawao/python-sonarqube-api", "keywords": "api sonar sonarqube", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "opn-sonarqube-api", "package_url": "https://pypi.org/project/opn-sonarqube-api/", "platform": "", "project_url": "https://pypi.org/project/opn-sonarqube-api/", "project_urls": { "Homepage": "https://github.com/kako-nawao/python-sonarqube-api" }, "release_url": "https://pypi.org/project/opn-sonarqube-api/1.7.0.176021/", "requires_dist": [ "requests (<2.99,>=2.9)" ], "requires_python": "", "summary": "Open SonarQube API Handler", "version": "1.7.0.176021" }, "last_serial": 5499488, "releases": { "1.3.1": [ { "comment_text": "", "digests": { "md5": "00161f57c852dfe40eee0e2ff7cfcc82", "sha256": "73100261ee63065485d039412e18fc589c93076a0a67d1b367ecd58cceda6322" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1-py2-none-any.whl", "has_sig": false, "md5_digest": "00161f57c852dfe40eee0e2ff7cfcc82", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 35208, "upload_time": "2019-03-29T17:04:32", "url": "https://files.pythonhosted.org/packages/8b/0b/3984d06e70fe17b1878c3f4c9c50eb431c0ab30fb96bf4fa142806d53547/opn_sonarqube_api-1.3.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a1fb8645bbbb896308de9909db76be4a", "sha256": "54712495edc2bbe5593a631085a82eea386697a787d2ac364ff69e28c4b0c269" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1.tar.gz", "has_sig": false, "md5_digest": "a1fb8645bbbb896308de9909db76be4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29578, "upload_time": "2019-03-29T17:04:34", "url": "https://files.pythonhosted.org/packages/2f/dc/5f0b8ed7ce845d8bb52a0e9bf95007a4d3ff0c6704e539eba44344b1a6d1/opn_sonarqube_api-1.3.1.tar.gz" } ], "1.3.1.132918": [ { "comment_text": "", "digests": { "md5": "3862bf434f4daa55b89e16e96700f814", "sha256": "64ba4337f9fe760bc72f649ae4e5bb962b25ef937fd13b1fc32809e40f469cfd" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1.132918-py2-none-any.whl", "has_sig": false, "md5_digest": "3862bf434f4daa55b89e16e96700f814", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20329, "upload_time": "2019-03-29T17:15:27", "url": "https://files.pythonhosted.org/packages/1a/f8/3ed9cb9b63c7d1251634a9d9b50ca7694627f8907879dfbc574481dd34dd/opn_sonarqube_api-1.3.1.132918-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bffc48ebacfdfd62ae82d4c38a38371b", "sha256": "e4c835da1fc7c541da86bfc6a8a48d02de62c3b4927c1f36ca793af31132d648" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1.132918.tar.gz", "has_sig": false, "md5_digest": "bffc48ebacfdfd62ae82d4c38a38371b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17878, "upload_time": "2019-03-29T17:15:28", "url": "https://files.pythonhosted.org/packages/a3/47/842e1d261e27387093c3ffa80f386b40b3f4d67e110cb8f45ae4c787963e/opn_sonarqube_api-1.3.1.132918.tar.gz" } ], "1.3.1.138056": [ { "comment_text": "", "digests": { "md5": "f8ee0948cdfd9e2d299a20bfeb5ee1dc", "sha256": "1a87cf6e6ebc771d4b1f05eb9ce04a43c7a99aa148012e188ad56526cec58084" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1.138056-py2-none-any.whl", "has_sig": false, "md5_digest": "f8ee0948cdfd9e2d299a20bfeb5ee1dc", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20394, "upload_time": "2019-04-10T07:54:48", "url": "https://files.pythonhosted.org/packages/90/0c/f9e9447853be15c9201782549436d634c09943dff71a0d2ad38098554de5/opn_sonarqube_api-1.3.1.138056-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "231c31b00d8db79f45cf02837accf1a8", "sha256": "f78aa664dba0cdb5f6981e45f4fc4df8af2ad85b4dce889d8721aac4e7cd7f02" }, "downloads": -1, "filename": "opn_sonarqube_api-1.3.1.138056.tar.gz", "has_sig": false, "md5_digest": "231c31b00d8db79f45cf02837accf1a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17911, "upload_time": "2019-04-10T07:54:50", "url": "https://files.pythonhosted.org/packages/b7/2d/16dc0ac763a36d934fc8b5a7e427b18fae4e64ffee2f1475dd8ceaf960e4/opn_sonarqube_api-1.3.1.138056.tar.gz" } ], "1.4.0.140227": [ { "comment_text": "", "digests": { "md5": "47430f1fe8ab2e81e74d3680b767c0f8", "sha256": "7539556a1447cfe21cd6c9cafd6782c90e3cd1fe6068cdae24ff590dc46f48e5" }, "downloads": -1, "filename": "opn_sonarqube_api-1.4.0.140227-py2-none-any.whl", "has_sig": false, "md5_digest": "47430f1fe8ab2e81e74d3680b767c0f8", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20569, "upload_time": "2019-04-12T13:57:02", "url": "https://files.pythonhosted.org/packages/4d/e6/a7c783025bfe5432ba734d846e49b9d8ebea9f2e0341ae357ef8e4e997ed/opn_sonarqube_api-1.4.0.140227-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "599f620b3c4ebeb853ddf73ffd735729", "sha256": "30338e26d7ea3c1f30ad87f67d94261c942a9fce0111228c9d080c88cd8c9194" }, "downloads": -1, "filename": "opn_sonarqube_api-1.4.0.140227.tar.gz", "has_sig": false, "md5_digest": "599f620b3c4ebeb853ddf73ffd735729", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22383, "upload_time": "2019-04-12T13:57:04", "url": "https://files.pythonhosted.org/packages/95/c0/aa454ca2e62896392763eb606024868d35ea2b1fb7a640f36af5877fbdf2/opn_sonarqube_api-1.4.0.140227.tar.gz" } ], "1.5.0.151793": [ { "comment_text": "", "digests": { "md5": "30dfd1e04ee7ed739365038105372f99", "sha256": "04a66ff95b8849ea7f565d3d8dba72722c9d6e9389900b33012a17ae7d1d902a" }, "downloads": -1, "filename": "opn_sonarqube_api-1.5.0.151793-py2-none-any.whl", "has_sig": false, "md5_digest": "30dfd1e04ee7ed739365038105372f99", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 21218, "upload_time": "2019-05-13T13:57:48", "url": "https://files.pythonhosted.org/packages/b5/af/7a3485cfd2019fbf47dfe10478c4e65e13ae82f67be6453185a827606ad6/opn_sonarqube_api-1.5.0.151793-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06e44a8c8d687ae08ef45a41796ff55e", "sha256": "5798ecb4afec7f60170ca700ccac2ab6a37aaf6d905a33073d017286ed2ea27d" }, "downloads": -1, "filename": "opn_sonarqube_api-1.5.0.151793.tar.gz", "has_sig": false, "md5_digest": "06e44a8c8d687ae08ef45a41796ff55e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22587, "upload_time": "2019-05-13T13:57:49", "url": "https://files.pythonhosted.org/packages/4b/0c/ac287aabf8b41014343dfad489b6d6345b270e8aadc89fbc3de0cf172ad8/opn_sonarqube_api-1.5.0.151793.tar.gz" } ], "1.5.1.154424": [ { "comment_text": "", "digests": { "md5": "2626cc472c28ac979465c6ef1e0bcc4d", "sha256": "41579eb7f934fc9a653ad7972aed13447720a355a8c821fcc7f21697ba0262f5" }, "downloads": -1, "filename": "opn_sonarqube_api-1.5.1.154424-py2-none-any.whl", "has_sig": false, "md5_digest": "2626cc472c28ac979465c6ef1e0bcc4d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 21219, "upload_time": "2019-05-17T16:50:03", "url": "https://files.pythonhosted.org/packages/f7/31/0e019a14dedf7d8fc947b6178819a2a30e8ce8e7fb9abbc092b5f9bfddef/opn_sonarqube_api-1.5.1.154424-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d6c1276f0a56c16ca2f396488a6e3305", "sha256": "b17d24853e81463945cb3b048f48b6a5adb36110ad5c745c3670f52c845f7a1d" }, "downloads": -1, "filename": "opn_sonarqube_api-1.5.1.154424.tar.gz", "has_sig": false, "md5_digest": "d6c1276f0a56c16ca2f396488a6e3305", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22574, "upload_time": "2019-05-17T16:50:05", "url": "https://files.pythonhosted.org/packages/ee/1d/4e3203b61faa799bb6dc8b222e065ec9c266fbb63ef8ea8ada5f0b2f97c9/opn_sonarqube_api-1.5.1.154424.tar.gz" } ], "1.6.0.155688": [ { "comment_text": "", "digests": { "md5": "2b58f87a735d1f65aba447dd59778fe4", "sha256": "750ef5d9eaddebbae22e82399e7d0a8fe3596e0b54f2818ac311023c580f7cb3" }, "downloads": -1, "filename": "opn_sonarqube_api-1.6.0.155688-py2-none-any.whl", "has_sig": false, "md5_digest": "2b58f87a735d1f65aba447dd59778fe4", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 21636, "upload_time": "2019-05-22T14:47:10", "url": "https://files.pythonhosted.org/packages/a1/b8/8b834f5eea1d45daa09092bb8efcdbcbb969184d65d68204008d15af0d93/opn_sonarqube_api-1.6.0.155688-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c003a93f19daecc3c7398895c9608f5", "sha256": "6367603a8e68477ccc311803e710f992cb16444a0a9551ef021b6d26b91fb4af" }, "downloads": -1, "filename": "opn_sonarqube_api-1.6.0.155688.tar.gz", "has_sig": false, "md5_digest": "9c003a93f19daecc3c7398895c9608f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18975, "upload_time": "2019-05-22T14:47:12", "url": "https://files.pythonhosted.org/packages/d2/64/d65b23468d2a0cb4d5e726451d0076b4e64e8e6795639243736562209277/opn_sonarqube_api-1.6.0.155688.tar.gz" } ], "1.7.0.176021": [ { "comment_text": "", "digests": { "md5": "31d93d7924f74b816d6eb553f9265025", "sha256": "ee7dbc808b837ed64eb8d80d82c590631c763c980ba241277cc155ad779403f4" }, "downloads": -1, "filename": "opn_sonarqube_api-1.7.0.176021-py2-none-any.whl", "has_sig": false, "md5_digest": "31d93d7924f74b816d6eb553f9265025", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 21702, "upload_time": "2019-07-08T08:15:54", "url": "https://files.pythonhosted.org/packages/84/cc/3bc299bd663b89a2d9332ef87e130feb4ee9ba2af4341d82aafe4c4c03fa/opn_sonarqube_api-1.7.0.176021-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bd52d3870311164b43b51bb45c628958", "sha256": "c98b17e3e1d1b219bac9bd1e16288944880f6c0eccc88a4eaa73f99bcbabafd5" }, "downloads": -1, "filename": "opn_sonarqube_api-1.7.0.176021.tar.gz", "has_sig": false, "md5_digest": "bd52d3870311164b43b51bb45c628958", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21021, "upload_time": "2019-07-08T08:15:56", "url": "https://files.pythonhosted.org/packages/60/86/fad95d9b9a02d00604f7a77980bfa9ba7fa6cb6d4d583a655c5dbab1efc7/opn_sonarqube_api-1.7.0.176021.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "31d93d7924f74b816d6eb553f9265025", "sha256": "ee7dbc808b837ed64eb8d80d82c590631c763c980ba241277cc155ad779403f4" }, "downloads": -1, "filename": "opn_sonarqube_api-1.7.0.176021-py2-none-any.whl", "has_sig": false, "md5_digest": "31d93d7924f74b816d6eb553f9265025", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 21702, "upload_time": "2019-07-08T08:15:54", "url": "https://files.pythonhosted.org/packages/84/cc/3bc299bd663b89a2d9332ef87e130feb4ee9ba2af4341d82aafe4c4c03fa/opn_sonarqube_api-1.7.0.176021-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bd52d3870311164b43b51bb45c628958", "sha256": "c98b17e3e1d1b219bac9bd1e16288944880f6c0eccc88a4eaa73f99bcbabafd5" }, "downloads": -1, "filename": "opn_sonarqube_api-1.7.0.176021.tar.gz", "has_sig": false, "md5_digest": "bd52d3870311164b43b51bb45c628958", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21021, "upload_time": "2019-07-08T08:15:56", "url": "https://files.pythonhosted.org/packages/60/86/fad95d9b9a02d00604f7a77980bfa9ba7fa6cb6d4d583a655c5dbab1efc7/opn_sonarqube_api-1.7.0.176021.tar.gz" } ] }