{ "info": { "author": "Wargaming Team", "author_email": "", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Application Frameworks" ], "description": "# aiohttp_baseapi\n\nThis is a micro framework for building HTTP APIs on a high level of abstraction on top of aiohttp.\nIt allows to create jsonapi-like HTTP interface to models in declarative way and leaves it possible to fine tune at any level.\n\n## Quick start\nInstall the package \n\n pip install aiohttp_baseapi\nCreates project directory structure in current directory (it also contains two sample apps)\n\n baseapi-start-project\nInstall the dependencies\n\n cd src/\n pip install -r .meta/packages\nConfigure Postgres DB connection\n\n echo \"DATABASE = {'host':'localhost','port':5432,'database':'test','user':'test','password':'test','minsize':1,'maxsize':10}\" > ./settings_local.py\nCreate migrations\n\n alembic revision --autogenerate -m \"init\"\nRun migrations\n\n alembic upgrade head\nRun the application\n\n python ./main.py --port=9000\n\nThat's it! You can try the API. \nIt contains \"default\" app - it just prints all existing API methods under \"/\" location. And \"demo\" app - it contains two sample models. \n\n http GET :9000\n http POST :9000/authors <<< '{\"data\":{\"name\":\"John\", \"surname\": \"Smith\"}}'\n http POST :9000/books <<< '{\"data\":{\"category\": \"Fiction\",\"name\":\"Birthday\",\"is_available\":true, \"author_id\": 1}}'\n http GET \":9000/books?filter[name]=Birthday&include=authors\"\n http GET :9000/books/1\n http PUT :9000/books/1 <<< '{\"data\":{\"is_available\":false}}'\n http DELETE :9000/books/1\n \n## Features \n\nThere are some built-in features you can use: \n\n * filtration\n * sorting\n * fields selection\n * pagination\n * inclusion\n * validation\n\nRequest and response formats are inspired by jsonapi.org, but have some differences.\n\nRetrieved information can be filtered using `filter` GET-parameter.\nYou can filter by multiple fields: `filter[fieldname1]=foo&filter[fieldname2]=bar`.\nIn this case in response there are values for which the `fieldname1` equals to `foo` and `fieldname2` equals to `bar`.\nAlso you can filter enumerating desired values: `filter[fieldname]=foo,bar`.\nIn this case in response there are values for which the `fieldname` equals to `foo` or `bar`.\n\nRetrieved information can be sorted using `sort` GET-parameter.\nAlso you can sort enumerating multiple values: `sort=fieldname1,-fieldname2`.\nIn this case values in response will be sorted by `fieldname1` ascending, and then by `fieldname2` descending.\n\nUsing parameter `fields` you can retrieve only those fields which you need.\nFor example: `fields=fieldname1,fieldname2`. In this case values in response will have only `fieldname1` and `fieldname2` fields.\n\nPagination (limit and offset) can be performed using `page` parameter.\nUsage: `page[limit]=10&page[offset]=20` - standard pagination (20 items skipped, maximum 10 returned).\n\nAlso there is possibility to attach related entities using parameter `include`.\nOne can apply described above features (filtration, sorting, etc.) to included entities. It will affect only included entities.\nExamples:\n`filter[entity.fieldname]=foo` - filtration;\n`sort[entity]=fieldname` - sorting;\n`fields[entity]=fieldname` - choosing fields;\n`page[entity.limit]=10` - pagination.\n\nThe data passed in modifying requests (POST, PUT, etc.) can be validated using json-schema (which can be auto-generated from model description) or manually.\nDefault data provider is database, but you can use anything you wish. \n\n## Unit tests\n\nRun:\n\n $ pip install -r .meta/packages_unit\n $ cd src\n $ make unit-test", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "aiohttp-baseapi", "package_url": "https://pypi.org/project/aiohttp-baseapi/", "platform": "", "project_url": "https://pypi.org/project/aiohttp-baseapi/", "project_urls": null, "release_url": "https://pypi.org/project/aiohttp-baseapi/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.1.4" }, "last_serial": 4402224, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "716646335cde36a6e0293b9624c93dbb", "sha256": "765f6ec144cc3bdafb406fd4c1b29a54ef3ac56c6c393a710468d9d65ca632fe" }, "downloads": -1, "filename": "aiohttp_baseapi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "716646335cde36a6e0293b9624c93dbb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18716, "upload_time": "2018-03-12T07:24:16", "url": "https://files.pythonhosted.org/packages/d0/b9/114504c910ba2e111ed6529a9bf81e6940da145d5764e6b3ffeddc74e32d/aiohttp_baseapi-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "98b2c44cfea5f08ecc360ddbc35b6a0d", "sha256": "67d1ce244c57c152f8d259f287bdffca33a736f2c0c874135f4850883813768f" }, "downloads": -1, "filename": "aiohttp_baseapi-0.1.4.tar.gz", "has_sig": false, "md5_digest": "98b2c44cfea5f08ecc360ddbc35b6a0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18696, "upload_time": "2018-10-22T13:43:19", "url": "https://files.pythonhosted.org/packages/75/60/428c33c21ad47cd227d0d6b06cf31100a54bdd4729bacb74e75d67261180/aiohttp_baseapi-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "98b2c44cfea5f08ecc360ddbc35b6a0d", "sha256": "67d1ce244c57c152f8d259f287bdffca33a736f2c0c874135f4850883813768f" }, "downloads": -1, "filename": "aiohttp_baseapi-0.1.4.tar.gz", "has_sig": false, "md5_digest": "98b2c44cfea5f08ecc360ddbc35b6a0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18696, "upload_time": "2018-10-22T13:43:19", "url": "https://files.pythonhosted.org/packages/75/60/428c33c21ad47cd227d0d6b06cf31100a54bdd4729bacb74e75d67261180/aiohttp_baseapi-0.1.4.tar.gz" } ] }