{ "info": { "author": "bob-nx", "author_email": "me@nagexiucai.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2 :: Only" ], "description": "# APIDocTest\r\nA lightweight Python WebAPI's documents and tests framework based on `__doc__`, VanillaJS-AJAX and Flask, but not limited to Flask.\r\n\r\n## Details\r\nEach of API handlers' `__doc__` line which starts with \"@\" will be treated as API's notes, excludes the leading spaces.\r\nThe \"::\" is the separator between key and value of each APIs='s note.\r\nblanks in both ends of key and value are ignored.\r\n\r\n|key|value(samples)|comments|\r\n|:--|:----|:-------|\r\n|@path-parameters|variablex=literalx & variabley=literaly & variablez=literalz|placeholders in router's url, such as \"/path/to//status\".|\r\n|@request-parameters|variablex=literalx & variabley=literaly & variablez=literalz|like things after \"?\" in url, such as \"http://nagexiucai.com/topic.php?title=ml-in-ten-pictures&md=ml-in-ten-pictures\".|\r\n|@request-headers|content-type:text/json;charset=utf-8 & user-agent:mozilla/5.0 gecko/20100101 firefox/38.0||\r\n|@request-body|{\"author\":\"bob-nx\"}||\r\n|@response-headers|content-type:text/html;charset=utf-8 & server:werkzeug/0.14.1 python/2.7.5||\r\n|@response-body|\"hi\"||\r\n|@norm|`==[caseignored]` or `~=[regular expression]` or ##|\"==\" for \"same\", \"~=\" for \"similar\", \"##\" for \"silent\"; if `\"[extra]\"` supplied, \"extra\" works.|\r\n\r\n## Examples\r\nThe core is use `APIDocTest('router', ['methods'], name='name', description='description' version=\"version\")` as handlers' first decorator.\r\n\r\n```\r\nfrom flask import blueprints\r\nfrom apidoctest import APIDocTest\r\n\r\nbapidoctest = blueprints.Blueprint(\"apidoctest\", __name__)\r\n\r\n@bapidoctest.route(\"/fuck\", methods=[\"GET\", \"POST\"])\r\n@APIDocTest(\"/fuck\", [\"GET\", \"POST\"], name=\"fuck\", description=\"uncourteous.\")\r\ndef Fuck():\r\n '''\r\n @path-parameters::\r\n @request-parameters::\r\n @request-headers:: Content-Type:application/json\r\n @request-body:: {\"who\":\"unknown\"}\r\n @response-headers:: Content-Type:text/html;charset=utf-8\r\n @response-body:: \"fuck\"\r\n @norm:: ==\r\n '''\r\n return \"fuck\"\r\n\r\nimport sys\r\nreload(sys)\r\nsys.setdefaultencoding(\"utf8\")\r\n\r\nfrom flask import Flask, request, render_template_string, json\r\nfrom apidoctest import APIDocTestTemplateString\r\nserv = Flask(\"APIDocTestDemo\")\r\n@serv.route(\"/apidoctest\")\r\ndef documents():\r\n return render_template_string(APIDocTestTemplateString, data=json.dumps(APIDocTest.apidocs, encoding=\"utf-8\"))\r\nserv.register_blueprint(bapidoctest, url_prefix=\"/what\")\r\nserv.run(debug=False, host=\"localhost\", port=9527)\r\n```\r\n\r\n## Result\r\nUse browser(Google Chrome recommended), access `http://localhost:9527/apidoctest`(in examples above).\r\n\r\n![](APIDocTestV0.0.3.jpg \"Google Chrome 72.0.3626.121 32bit\")\r\n\r\n- 2xx: black\r\n- 3xx: orange\r\n- 4xx: blue\r\n- 5xx: red\r\n\r\n# ToDo\r\n- I18n(Chinese friendly now)\r\n- Parameters validation\r\n- Input/Output grouped by test cases\r\n- Input/Output type adaption\r\n\r\n\r\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nagexiucai/APIDocTest", "keywords": "pip,apidoc,test,api,document,flask", "license": "", "maintainer": "", "maintainer_email": "", "name": "APIDocTest", "package_url": "https://pypi.org/project/APIDocTest/", "platform": "", "project_url": "https://pypi.org/project/APIDocTest/", "project_urls": { "Homepage": "https://github.com/nagexiucai/APIDocTest" }, "release_url": "https://pypi.org/project/APIDocTest/0.0.3/", "requires_dist": null, "requires_python": ">=2.6, <3", "summary": "A lightweight Python WebAPI's documents and tests framework based on __doc__, VanillaJS-AJAX and Flask, but not limited to Flask.", "version": "0.0.3" }, "last_serial": 4990617, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "65d5756954c5967049fd155339142034", "sha256": "e6fe6c788aa643bd0e7fb3700c70415a57a024f54ceda6e9fec0e96d0d48864c" }, "downloads": -1, "filename": "APIDocTest-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "65d5756954c5967049fd155339142034", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.6, <3", "size": 779299, "upload_time": "2019-03-18T07:38:22", "url": "https://files.pythonhosted.org/packages/fc/bf/d73787a83f7b3bc67dd1665c22e3ae7213afaf8f0f10d3e8a492e461d69c/APIDocTest-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c54a8118b62ba18444a04642d33fa40f", "sha256": "4f819410ecea91b6181ac04fcf193bb81a506e165f551cef778a39bd2681ed0f" }, "downloads": -1, "filename": "APIDocTest-0.0.1.tar.gz", "has_sig": false, "md5_digest": "c54a8118b62ba18444a04642d33fa40f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6, <3", "size": 779421, "upload_time": "2019-03-18T07:38:29", "url": "https://files.pythonhosted.org/packages/17/7e/f7e4f0a0e5e29f29c8603c4de52b3213a76e7d8419b6c3a421a315795483/APIDocTest-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "7b2104a6f251b4fbe9783a1154d0337a", "sha256": "7198345ee75d65e8409f92ae77285b98ed03ebd72084fe19a2b060c7b24d69cd" }, "downloads": -1, "filename": "APIDocTest-0.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "7b2104a6f251b4fbe9783a1154d0337a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.6, <3", "size": 599307, "upload_time": "2019-03-21T07:50:04", "url": "https://files.pythonhosted.org/packages/54/c4/409ee648067b0c5b85089c5d7601c8e1c6d1263ec890cd38eb309ca2978f/APIDocTest-0.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "93a877911185cacdd193e6d9a6afff62", "sha256": "7cf3164d6ba3db163dd747bce78f7a692fb10b15d956a1d61a83df99707660e3" }, "downloads": -1, "filename": "APIDocTest-0.0.2.tar.gz", "has_sig": false, "md5_digest": "93a877911185cacdd193e6d9a6afff62", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6, <3", "size": 1366294, "upload_time": "2019-03-21T07:50:08", "url": "https://files.pythonhosted.org/packages/b0/b3/3a41afda54f4eb2ef9ade9a810a9f7282b63d907773282a1ccee84ecbb20/APIDocTest-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "487ff3518c49ee48d8988e7002757bef", "sha256": "4873fdeb2c108b69c96208ff6f172d653b6102732fc46b5059a524b40996901c" }, "downloads": -1, "filename": "APIDocTest-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "487ff3518c49ee48d8988e7002757bef", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.6, <3", "size": 45287, "upload_time": "2019-03-27T03:05:26", "url": "https://files.pythonhosted.org/packages/50/39/43fcdc7ff8f1ac88c3a48c4ce4e1695214f84dbb6f7485ec113ac14e1675/APIDocTest-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bda16559dca3076f24c56f304ede7655", "sha256": "f1aa8d65b8dff0a7cc9000b1ed5ad8238f2766f7dd992c86c86a8f2207098dec" }, "downloads": -1, "filename": "APIDocTest-0.0.3.tar.gz", "has_sig": false, "md5_digest": "bda16559dca3076f24c56f304ede7655", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6, <3", "size": 45564, "upload_time": "2019-03-27T03:05:28", "url": "https://files.pythonhosted.org/packages/a9/05/a0e95a90309c16e33e006e1d39c675a78464cb3c85f5901556b3445c785f/APIDocTest-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "487ff3518c49ee48d8988e7002757bef", "sha256": "4873fdeb2c108b69c96208ff6f172d653b6102732fc46b5059a524b40996901c" }, "downloads": -1, "filename": "APIDocTest-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "487ff3518c49ee48d8988e7002757bef", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.6, <3", "size": 45287, "upload_time": "2019-03-27T03:05:26", "url": "https://files.pythonhosted.org/packages/50/39/43fcdc7ff8f1ac88c3a48c4ce4e1695214f84dbb6f7485ec113ac14e1675/APIDocTest-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bda16559dca3076f24c56f304ede7655", "sha256": "f1aa8d65b8dff0a7cc9000b1ed5ad8238f2766f7dd992c86c86a8f2207098dec" }, "downloads": -1, "filename": "APIDocTest-0.0.3.tar.gz", "has_sig": false, "md5_digest": "bda16559dca3076f24c56f304ede7655", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.6, <3", "size": 45564, "upload_time": "2019-03-27T03:05:28", "url": "https://files.pythonhosted.org/packages/a9/05/a0e95a90309c16e33e006e1d39c675a78464cb3c85f5901556b3445c785f/APIDocTest-0.0.3.tar.gz" } ] }