{ "info": { "author": "Benoit Petit", "author_email": "bpetit@b0rk.in", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Build Tools" ], "description": "netboxapi-client\n================\n\nThis is a python client for netbox (https://github.com/digitalocean/netbox) API. It can be used either as a python module/library or directly from the command line.\nThe goal of this project is to provide a simple way to automate infrastructure documentation based on the REST API from that great project that is Netbox.\n\nStatus\n------\n\nUnder development.\n\nCurrent developments are tested on netbox v2.2.2 and above.\n\nInstallation\n------------\n\nYou can clone that repo and install locally with:\n\n.. code-block:: bash\n\n\tpython setup.py build && pip install -e .\n\nProper pypi package on it's way.\n\nUsage\n-----\n\nFrom CLI, using a configuration file:\n\nCopy `netboxapi.json.example` file to `netboxapi.json` and edit that file to match your netbox instance url and token.\n\n`python netboxapi_client.py -h` will give you the overview of the models you can act on. `-h` is available at each depth level of the cli.\n\nHere are some examples:\n\n.. code-block:: bash\n\n\tnetboxapi_client -h\n\tnetboxapi_client dcim -h category\n\tnetboxapi_client dcim devices -h\n\tnetboxapi_client dcim devices list\n\tnetboxapi_client dcim devices create -d '$(cat mydevice.json)'\n\tnetboxapi_client dcim devices create \\\n\t\t-d '{ \"name\": \"sw-02-par-eq2\", \\\n\t\t \"slug\": \"sw-02-par-eq2\", \\\n\t\t \"device_role\": \"1\", \\\n\t\t \"device_type\": \"8\", \\\n\t\t \"site\": \"184\" }'\n\tnetboxapi_client dcim devices show -n sw-02-par-eq2\n\tnetboxapi_client dcim devices show -i 10\n\tnetboxapi_client dcim devices delete -n sw-02-par-eq2\n\nFrom code:\n\nThis is a very basic example:\n\n.. code-block:: python\n\n\tfrom pprint import pprint\n\tfrom netboxapi_client import Api, get\n\n\tTOKEN = \"thetokenyoucangetfromnetboxwebuionauserprofilepage\"\n\tURL = \"https://netbox.example.org\"\n\n\tapi = Api(url=URL, token=TOKEN)\n\n\tres = get(api, model=\"dcim\", obj=\"devices\", name=\"sw-02-par-eq2\")\n\n\tpprint(res)\n\nFor now, you have to import the Api class and the function you need (get, get_list, update, create, delete, and so on...). This will be improved soon...\n\nHow-to test\n-----------\n\nInstall docker and docker-compose and then:\n\n.. code-block:: bash\n\n sudo docker-compose run --rm netbox createsuperuser\n\nYou will be prompted for a username, email and password for the superuser.\n\n.. code-block:: bash\n\n sudo docker-compose up -d\n\nThen you have to connect to the netbox instance you just installed. It should be accessible at http://localhost:8000 . Login with the credentials you choosed earlier. On the top right you can select username > profile. Then click on \"API tokens\" and create one, either use the one writen in tests/basic.py or choose one and replace the one in this file. (yeah token creation could be automated, it will be...)\n\nThen you can try querying the api as described earlier.\n\nTo run unit tests:\n\n.. code-block:: bash\n\n python tests/basic.py\n\nTODO\n----\n\n- prevent sending multiple requests/discovering the model if not required\n- better catch exceptions to give users a more comprehensive output\n- setup CI/CD pipeline and build status on github\n- push docker image to public repo and add docker-compose.yml, entrypoint.sh to the repo, add testing process to documentation\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/bpetit/netboxapi-client/archive/0.1-a3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bpetit/netboxapi-client", "keywords": "infrastructure documentation api", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "netboxapi-client", "package_url": "https://pypi.org/project/netboxapi-client/", "platform": "", "project_url": "https://pypi.org/project/netboxapi-client/", "project_urls": { "Download": "https://github.com/bpetit/netboxapi-client/archive/0.1-a3.tar.gz", "Homepage": "https://github.com/bpetit/netboxapi-client" }, "release_url": "https://pypi.org/project/netboxapi-client/0.1b1/", "requires_dist": null, "requires_python": "~=2.7", "summary": "Python client for netbox API", "version": "0.1b1" }, "last_serial": 3303382, "releases": { "0.1a3": [ { "comment_text": "", "digests": { "md5": "6039fe9c229e9900041d661dd574db5d", "sha256": "739068867d0979706c5f8a74c90e27f771498b3cbef3665640cd5d6761e03b1f" }, "downloads": -1, "filename": "netboxapi_client-0.1a3-py2-none-any.whl", "has_sig": false, "md5_digest": "6039fe9c229e9900041d661dd574db5d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=2.7", "size": 4707, "upload_time": "2017-10-17T15:21:20", "url": "https://files.pythonhosted.org/packages/18/bc/a197257bae178e3300231666c5348c1df640800e668546b39fe28795b8fb/netboxapi_client-0.1a3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6bfe1dcd9c46bdc76508ff8d1a8b3b5e", "sha256": "afcafa60d3a102e2d596105805414b35c6931d5ab1628728fc8f9d1d61c6a6b6" }, "downloads": -1, "filename": "netboxapi_client-0.1a3.tar.gz", "has_sig": false, "md5_digest": "6bfe1dcd9c46bdc76508ff8d1a8b3b5e", "packagetype": "sdist", "python_version": "source", "requires_python": "~=2.7", "size": 3627, "upload_time": "2017-10-17T15:21:21", "url": "https://files.pythonhosted.org/packages/8c/b4/eb2c2079cad185a9d85601e9aa10a56c1a54e564bfbcbd34e8cc62a6c4e5/netboxapi_client-0.1a3.tar.gz" } ], "0.1b1": [ { "comment_text": "", "digests": { "md5": "8d7fda4ea651039121ca3237253246c0", "sha256": "3ebdd944b3895857396f0613a666f7686116da6af70462868e3e137115a0de4f" }, "downloads": -1, "filename": "netboxapi_client-0.1b1-py2-none-any.whl", "has_sig": false, "md5_digest": "8d7fda4ea651039121ca3237253246c0", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=2.7", "size": 9689, "upload_time": "2017-11-03T14:57:42", "url": "https://files.pythonhosted.org/packages/b3/40/def2014dd99c1ce091cc0ba2ee51b606a99c1439234b2302a699e5e35401/netboxapi_client-0.1b1-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d7fda4ea651039121ca3237253246c0", "sha256": "3ebdd944b3895857396f0613a666f7686116da6af70462868e3e137115a0de4f" }, "downloads": -1, "filename": "netboxapi_client-0.1b1-py2-none-any.whl", "has_sig": false, "md5_digest": "8d7fda4ea651039121ca3237253246c0", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=2.7", "size": 9689, "upload_time": "2017-11-03T14:57:42", "url": "https://files.pythonhosted.org/packages/b3/40/def2014dd99c1ce091cc0ba2ee51b606a99c1439234b2302a699e5e35401/netboxapi_client-0.1b1-py2-none-any.whl" } ] }