{ "info": { "author": "Will Stevens", "author_email": "wstevens@cloudops.com", "bugtrack_url": null, "classifiers": [], "description": "NITRO API Wrapper\n=================\nThis project is a minimalist wrapper around the NetScaler NITRO API. Its purpose \nis to expedite the process of testing the API and building scripts to do useful tasks.\n\nIt is expected that you refer to the NITRO documentation while using this lib.\n\nThere are two ways in which this lib can be consumed:\n\n1. The `API` class can be instantiated from any code. It has a single `request`\n method, which is used to make API calls against NITRO.\n\n2. The `CLI` class is a subclass of `API` and is designed to be a convenience\n class for working with stand alone scripts that populate the `API` constructor\n using command line arguments parsed by `docopt`. The command line arguments can be\n passed in directly or they can be added to a JSON file and the `--json` flag can\n be used to reference the JSON file path. A `cli_example.py` file is included in\n the package to give a working example of how to use this use case.\n\nThe `request` method takes a NITRO API call and returns a python dictionary with \nthe result.\n\n``` python\napi.request(self, path, payload=None, method=None)\n```\n\n``` sphinx\nBuilds the request and returns a json object of the result or None.\nIf 'payload' is specified, the request will be a POST, otherwise it will be a GET.\n\n:param path: a path appended to 'self.base_path' (default of '/nitro/v1'), \n eg: path='/config' => '/nitro/v1/config'\n:type path: str or unicode\n\n:param payload: the object to be passed to the server\n:type payload: dict or None\n\n:param method: the request method [ GET | POST | PUT | DELETE ]\n:type method: str or unicode\n\n:returns: the result of the request as a dictionary; \n if result is json: return json as a dict\n if result == '': return {'headers': }\n if result != json and result != '': return {'result': ''}\n:rtype: dict or None\n```\n\n\n**Examples using the parent `API` class:**\n\n``` python\nfrom nitroapi import API\n\n# Recommended usage using WITH (to automatically login and logout):\nwith API(username=\"your user\", password=\"your pass\", endpoint=\"ns url\") as api:\n system_stats = api.request('/stat/system')\n\n# Manual setup and tear down example (requires explicit logout):\napi = API(username=\"your user\", password=\"your pass\", endpoint=\"ns url\")\napi.request('/config/login', {\n 'login': {\n 'username':api.username,\n 'password':api.password\n }\n})\nsystem_stats = api.request('/stat/system')\napi.request('/config/logout', {'logout': {}})\n```\n\n\n**Examples using the `CLI` sub-class:**\nDuplicate the `./cli_example.py` to get started.\n\n``` python\nfrom nitroapi import CLI\n\n# Recommended usage using WITH (to automatically login and logout):\nwith CLI(__doc__) as api:\n pprint.pprint(api.request('/stat/system'))\n\n# Manual setup and tear down example (requires explicit logout):\napi = CLI(__doc__)\napi.request('/config/login', {\n 'login': {\n 'username':api.username,\n 'password':api.password\n }\n})\nsystem_stats = api.request('/stat/system')\napi.request('/config/logout', {'logout': {}})\n```\n\n\nINSTALL\n=======\nThe easiest way to install this library is through `pip`.\n\n``` bash\n$ pip install nitroapi\n```\n\nAlternatively, you can pull down the source code directly and install manually.\n\n``` bash\n$ git clone https://github.com/swill/nitroapi.git\n$ cd nitroapi\n$ python setup.py install\n```\n\n\nUSAGE\n=====\nThe core functionality is documented above, but it is worth spending a minute\nto better describe the `CLI` use case. \n\n``` bash\n$ ./cli_example.py --help\n\nUsage:\n cli_example.py [--json=] [--endpoint= --username= --password=] [options]\n cli_example.py (-h | --help)\n\nOptions:\n -h --help Show this screen.\n --json= Path to a JSON config file with the same names as the options (without the '--' prefix).\n --endpoint= NetScaler URL.\n --username= NetScaler username.\n --password= NetScaler password.\n --base_path= Base NetScaler API path [default: /nitro/v1].\n --logging= Boolean to turn on or off logging [default: True].\n --log_level= The logging verbosity. [default: DEBUG].\n Valid entries are: CRITICAL | ERROR | WARNING | INFO | DEBUG | NOTSET\n --log= The log file to be used [default: logs/nitroapi.log].\n --clear_log= Removes the log each time the API object is created [default: True].\n --verify_ssl= Verify the SSL Certificate for a target HTTPS endpoint [default: True].\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/swill/nitroapi", "keywords": null, "license": "Apache Licence v2.0", "maintainer": null, "maintainer_email": null, "name": "nitroapi", "package_url": "https://pypi.org/project/nitroapi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/nitroapi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/swill/nitroapi" }, "release_url": "https://pypi.org/project/nitroapi/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Minimal wrapper around the NetScaler NITRO API", "version": "0.1.0" }, "last_serial": 2284825, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4f316ca385604e2fa9748da84b664b6e", "sha256": "73b06314b4862c6a32ad7d320bae0fe6fc81570687a67e973d7449a0a83a7833" }, "downloads": -1, "filename": "nitroapi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4f316ca385604e2fa9748da84b664b6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5754, "upload_time": "2016-08-16T19:10:51", "url": "https://files.pythonhosted.org/packages/58/05/71421a4d31e6d30ef896fe7b3fcdc1ca07eb3aaecceaba79be8e7c683606/nitroapi-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4f316ca385604e2fa9748da84b664b6e", "sha256": "73b06314b4862c6a32ad7d320bae0fe6fc81570687a67e973d7449a0a83a7833" }, "downloads": -1, "filename": "nitroapi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4f316ca385604e2fa9748da84b664b6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5754, "upload_time": "2016-08-16T19:10:51", "url": "https://files.pythonhosted.org/packages/58/05/71421a4d31e6d30ef896fe7b3fcdc1ca07eb3aaecceaba79be8e7c683606/nitroapi-0.1.0.tar.gz" } ] }