{ "info": { "author": "Emmanouil Konstantinidis", "author_email": "manos@iamemmanouil.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "coreapidocs [![travis][travis-image]][travis-url] [![pypi][pypi-image]][pypi-url]\n===\nDocument APIs with CoreAPI.\n\n### Prerequisites\n\n - Python (2.7, 3.3, 3.4, 3.5)\n - Core API ([Read More](http://www.coreapi.org/))\n\n\n### Installation\nYou can install `coreapidocs` through pypi.\n\n pip install coreapidocs\n\n\n### Usage\nYou will have to pass a `.json` document to initialize the docs.\n\n```python\nfrom coreapidocs.docs import Docs\n\ntry:\n schema = open(filename, 'rb').read()\n docs = Docs(schema)\nexcept (IOError, OSError):\n abort(400, {\"msg\": \"No such file or directory - %s\" % filename})\n```\n\nThen you can simply pass the `docs` variable to your template (ie. Flask):\n\n```python\nreturn render_template('home.html', docs=docs.get_docs())\n```\n\nFor more information view the source of [example.py](coreapidocs/example.py).\n\n\n### Development\nCreate the virtualenv and install the requirements.\n\n virtualenv env\n source env/bin/activate\n\n pip install -r requirements.txt\n\n\nYou will need to pass an argument ie. `document.json`.\n\n python coreapidocs/example.py document.json\n # Then go to: http://127.0.0.1:5000/\n\n\n### Usage\nBelow you can find an example Flask application. Using `jinja2` you can pass the `coreapidocs` template to your view.\n\n```python\nimport sys\nimport jinja2\nfrom flask import Flask, abort, render_template\nfrom coreapidocs.docs import Docs\n\n\napp = Flask(__name__)\n\n\n@app.route('/')\ndef docs():\n \"\"\"\n Generate the coreapidocs and serve them to roor.\n Accepts one parameter with a filename (ie. document.json)\n \"\"\"\n\n if len(sys.argv) != 2:\n abort(400, {\"msg\": \"Missing file parameter ie. document.json\"})\n\n filename = sys.argv[-1]\n\n try:\n schema = open(filename, 'rb').read()\n docs = Docs(schema)\n except (IOError, OSError):\n abort(400, {\"msg\": \"No such file or directory - %s\" % filename})\n\n templates_loader = jinja2.PackageLoader('coreapidocs', 'templates')\n template_env = jinja2.Environment(loader=templates_loader)\n template = template_env.get_template('docs.html')\n\n # FIXME: Figure out how to pas static files\n\n return render_template(template, docs=docs.get_docs())\n\n\n@app.route('/')\ndef static_proxy(path):\n \"\"\"\n Serve static files.\n \"send_static_file\" will guess the correct MIME type\n \"\"\"\n return app.send_static_file(path)\n\n\nif __name__ == '__main__':\n app.debug = True\n app.run()\n```\n\n\n### Tests\nIn order to run the tests you will have to run:\n\n python runtests.py\n\n\n[travis-image]: https://travis-ci.org/ekonstantinidis/coreapidocs.svg\n[travis-url]: https://travis-ci.org/ekonstantinidis/coreapidocs\n\n[pypi-image]: https://badge.fury.io/py/coreapidocs.svg\n[pypi-url]: https://pypi.python.org/pypi/coreapidocs/", "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/ekonstantinidis/coreapidocs", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "coreapidocs", "package_url": "https://pypi.org/project/coreapidocs/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/coreapidocs/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ekonstantinidis/coreapidocs" }, "release_url": "https://pypi.org/project/coreapidocs/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Document APIs with CoreAPI.", "version": "0.0.2" }, "last_serial": 2072415, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "b6a7a156afe713636d7ab852d495a2b5", "sha256": "a3d2aafa285e9d4f7684add26dc37a79f97ea09d8e156b751cba48cf365be8ed" }, "downloads": -1, "filename": "coreapidocs-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b6a7a156afe713636d7ab852d495a2b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1974, "upload_time": "2016-04-07T16:38:38", "url": "https://files.pythonhosted.org/packages/07/99/b002d9eb21d25700080509c77c6bd9c5a76f4d506a5743b3e5afbc0b6ce5/coreapidocs-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "85770f5893d0604509d566e9161b7d08", "sha256": "1a9c45f7852a3dda5efde52be439f0340f286439d874b7d133e0c973c76b1906" }, "downloads": -1, "filename": "coreapidocs-0.0.2.tar.gz", "has_sig": false, "md5_digest": "85770f5893d0604509d566e9161b7d08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6441, "upload_time": "2016-04-19T20:41:54", "url": "https://files.pythonhosted.org/packages/09/60/b6ae0615b6eeb2b45c170ac5fcc4298141fd5685e517785ca682983a2c2d/coreapidocs-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "85770f5893d0604509d566e9161b7d08", "sha256": "1a9c45f7852a3dda5efde52be439f0340f286439d874b7d133e0c973c76b1906" }, "downloads": -1, "filename": "coreapidocs-0.0.2.tar.gz", "has_sig": false, "md5_digest": "85770f5893d0604509d566e9161b7d08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6441, "upload_time": "2016-04-19T20:41:54", "url": "https://files.pythonhosted.org/packages/09/60/b6ae0615b6eeb2b45c170ac5fcc4298141fd5685e517785ca682983a2c2d/coreapidocs-0.0.2.tar.gz" } ] }