{ "info": { "author": "jgv", "author_email": "jgv@trustpilot.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 3.6" ], "description": "|Build Status| |Latest Version| |Python Support|\n\nSanicargs\n=========\n\nParses query args in `Sanic `__\nusing type annotations.\n\nSurvey\n------\n\nPlease fill out `this\nsurvey `__\nif you are using Sanicargs, we are gathering feedback :-)\n\nInstall\n-------\n\nInstall with pip\n\n::\n\n $ pip install sanicargs\n\nUsage\n-----\n\nUse the ``parse_query_args`` decorator to parse query args and type cast\nquery args and path params with\n`Sanic `__'s routes or blueprints\nlike in the\n`example `__\nbelow:\n\n.. code:: python\n\n import datetime\n from sanic import Sanic, response\n from sanicargs import parse_query_args\n\n app = Sanic(\"test_sanic_app\")\n\n @app.route(\"/me//birthdate\", methods=['GET'])\n @parse_query_args\n async def test_datetime(req, id: str, birthdate: datetime.datetime):\n return response.json({\n 'id': id, \n 'birthdate': birthdate.isoformat()\n })\n\n if __name__ == \"__main__\":\n app.run(host=\"0.0.0.0\", port=8080, access_log=False, debug=False)\n\nTest it running with\n\n.. code:: bash\n\n $ curl 'http://0.0.0.0:8080/me/123/birthdate?birthdate=2017-10-30'\n\nFields\n~~~~~~\n\n- **str** : ``ex: ?message=hello world``\n- **int** : ``ex: ?age=100``\n- **bool** : ``ex: ?missing=false``\n- **datetime.datetime** :\n ``ex: ?currentdate=2017-10-30T10:10:30 or 2017-10-30``\n- **datetime.date** : ``ex: ?birthdate=2017-10-30``\n- **List[str]** : ``ex: ?words=you,me,them,we``\n\nNote about datetimes\n~~~~~~~~~~~~~~~~~~~~\n\nDates and datetimes are parsed without timezone information giving you a\n\"naive datetime\" object. See the note on\n`datetime.timestamp() `__\nabout handling timezones if you require epoch format timestamps.\n\nImportant notice about decorators\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe sequence of decorators is, as usual, important in Python.\n\nYou need to apply the ``parse_query_args`` decorator as the first one\nexecuted which means closest to the ``def``.\n\n``request`` is mandatory!\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou should always have request as the first argument in your function in\norder to use ``parse_query_args``.\n\n**Note** that ``request`` arg can be renamed and even type-annotated as\nlong as it is the first arg.\n\n.. |Build Status| image:: https://travis-ci.org/trustpilot/python-sanicargs.svg?branch=master\n :target: https://travis-ci.org/trustpilot/python-sanicargs\n.. |Latest Version| image:: https://img.shields.io/pypi/v/sanicargs.svg\n :target: https://pypi.python.org/pypi/sanicargs\n.. |Python Support| image:: https://img.shields.io/pypi/pyversions/sanicargs.svg\n :target: https://pypi.python.org/pypi/sanicargs\n\n\nHistory\n=======\n\n0.0.1 (2017-01-09)\n------------------\n\n* git init\n\n1.0.0(2017-01-12)\n------------------\n\n* added test suite\n* added path_param type casting\n\n1.1.0(2018-03-01)\n------------------\n\n* request can be renamed and even type-annotated\n\n1.2.0 (2018-03-01)\n------------------\n\n* added support for boolean parameters\n\n1.3.0 (2019-01-08)\n------------------\n\n* @wraps the inner function to keep the args signature\n\n1.4.0 (2019-03-04)\n------------------\n\n* Update deps to allow latest version of sanic", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/trustpilot/python-sanicargs", "keywords": "sanicargs sanic query args type annotations", "license": "", "maintainer": "", "maintainer_email": "", "name": "sanicargs", "package_url": "https://pypi.org/project/sanicargs/", "platform": "", "project_url": "https://pypi.org/project/sanicargs/", "project_urls": { "Homepage": "https://github.com/trustpilot/python-sanicargs" }, "release_url": "https://pypi.org/project/sanicargs/1.4.0/", "requires_dist": null, "requires_python": "", "summary": "Parses query args in sanic using type annotations", "version": "1.4.0" }, "last_serial": 5848871, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "483fe6d199fa529d3e55d0673c6d9f54", "sha256": "845cc94d4ff2f12c8e061a293741b4bf32e8e997b12da74c3c8d834a5646a8aa" }, "downloads": -1, "filename": "sanicargs-0.0.2.tar.gz", "has_sig": false, "md5_digest": "483fe6d199fa529d3e55d0673c6d9f54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3936, "upload_time": "2018-01-11T13:25:29", "url": "https://files.pythonhosted.org/packages/c4/2c/0877b5e8cc44ce53f4367b4406e6c42969b2e5f2883d3162d805e99061a7/sanicargs-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "708ba0ed214c76d94f087ec98f729235", "sha256": "08e86f52f496121e2732d23b7abc8f52c0229d4881b6e33c2e1cd7657584dbb5" }, "downloads": -1, "filename": "sanicargs-0.0.3.tar.gz", "has_sig": false, "md5_digest": "708ba0ed214c76d94f087ec98f729235", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3983, "upload_time": "2018-01-11T13:41:38", "url": "https://files.pythonhosted.org/packages/27/ae/4f2e8cc586af116d1d2fb7df6583316f67e7df9ac9c7833f144b880a55ce/sanicargs-0.0.3.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "797e83abe8db6a304a6859ab418ef34d", "sha256": "893797427183ac8dcca99d48ea9b04f3079e5b06bea22090c9bb4c99ab704434" }, "downloads": -1, "filename": "sanicargs-1.0.0.tar.gz", "has_sig": false, "md5_digest": "797e83abe8db6a304a6859ab418ef34d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5009, "upload_time": "2018-01-12T12:15:56", "url": "https://files.pythonhosted.org/packages/24/9a/8a357786db793461717a2b3cdce72c084a37db7c02b25518a254338e1027/sanicargs-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "61022c10985ba39449f038da8a8be7d2", "sha256": "2bc995457236fcf3a990e835b2d6353ed78ad353330791be7fbee45b39831d5c" }, "downloads": -1, "filename": "sanicargs-1.1.0.tar.gz", "has_sig": false, "md5_digest": "61022c10985ba39449f038da8a8be7d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5140, "upload_time": "2018-03-01T10:05:58", "url": "https://files.pythonhosted.org/packages/07/9a/6d7cf501d15aa84b73f0043a0f76662da4742fc5b6234571c3d7e1c6d4d4/sanicargs-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "fc8f884444e9dab9929b23627e376767", "sha256": "935b0204fe9301437f6bece7e7b55ecdb02281c013f010f0bedc10cd6901b28b" }, "downloads": -1, "filename": "sanicargs-1.2.0.tar.gz", "has_sig": false, "md5_digest": "fc8f884444e9dab9929b23627e376767", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5339, "upload_time": "2018-03-21T12:27:28", "url": "https://files.pythonhosted.org/packages/bf/76/a796c13ba1a516903ce378958ae39095b648a2ee2002b67084825b46e78a/sanicargs-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "a231cbc1f6ff82bb9dc504928c2caa8a", "sha256": "bc8243eaf1eaf0d0706d83b68bff03da599500d6f83fcd241c2beb648b494563" }, "downloads": -1, "filename": "sanicargs-1.3.0.tar.gz", "has_sig": false, "md5_digest": "a231cbc1f6ff82bb9dc504928c2caa8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5862, "upload_time": "2019-01-08T12:10:17", "url": "https://files.pythonhosted.org/packages/10/90/3d3baf3df862ce1a8d6b1cf0b97010f271f97d1782a9b243a24a958869e0/sanicargs-1.3.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "1ad94f744461aaad2c02f7ae3b6aa144", "sha256": "35083c9cdb8c665b6b546d648779d49634d6346bff63f948d1fb0f0bd84d78f3" }, "downloads": -1, "filename": "sanicargs-1.4.0.tar.gz", "has_sig": false, "md5_digest": "1ad94f744461aaad2c02f7ae3b6aa144", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5912, "upload_time": "2019-04-04T09:08:38", "url": "https://files.pythonhosted.org/packages/6b/99/5f11dd3bf93e567c9ce4cd516910d5973149fedcb082438d8e60e5ea3e39/sanicargs-1.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1ad94f744461aaad2c02f7ae3b6aa144", "sha256": "35083c9cdb8c665b6b546d648779d49634d6346bff63f948d1fb0f0bd84d78f3" }, "downloads": -1, "filename": "sanicargs-1.4.0.tar.gz", "has_sig": false, "md5_digest": "1ad94f744461aaad2c02f7ae3b6aa144", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5912, "upload_time": "2019-04-04T09:08:38", "url": "https://files.pythonhosted.org/packages/6b/99/5f11dd3bf93e567c9ce4cd516910d5973149fedcb082438d8e60e5ea3e39/sanicargs-1.4.0.tar.gz" } ] }