{ "info": { "author": "Motoki Naruse", "author_email": "motoki@naru.se", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries" ], "description": "=======\nParsely\n=======\n\n.. image:: https://travis-ci.org/narusemotoki/parsely.svg?branch=master\n :target: https://travis-ci.org/narusemotoki/parsely\n\nParsely is a framework for enqueuing messages via HTTP request for celery.\n\n`CHANGELOG `_\n\nExample\n=======\n\ntasks.py:\n---------\n\n.. code-block:: python\n\n from typing import Dict\n\n import parsely\n\n\n app = parsely.Parsely('example', 'redis://localhost:6379/0')\n\n\n def two_times(text: str) -> Dict[str, str]:\n return {\n 'text': text * 2\n }\n \n \n @app.task(two_times)\n def echo(text: str) -> None:\n print(text)\n\n\n worker = p.celery\n producer = p.make_producer()\n\n\n:code:`two_times` works as pre processor. It works before enqueing. It means it can return BadRequest to your client. Parsely validate message with typehint. Also you can have extra validation and any other process here.\n\nYou can run `tasks.py` as Celery worker: :code:`celery -A tasks worker --loglevel=info`\n\nAlso it runs as WSGI application. This is an example run it with uWSGI :code:`uwsgi --http :8080 --wsgi-file tasks.py --callable producer --enable-threads --thunder-lock --master`\n\nSend Test Message!\n------------------\n\n:code:`curl -X POST -d '{\"message\":{\"text\": \"Hello\"}}' http://localhost:8080/example/echo`\n\n1. `producer` receives your request\n2. `producer` validates your message having `text` and the type is `str` or not. `text`(str)` is from typehint of :code:`two_times`\n3. `producer` validates `two_times` returned value having `text` and the type is `str` or not. `text`(str)` is from typehint of :code:`echo`\n4. `producer` put message :code:`{\"message\":{\"text\":\"HelloHello\"}}` into queue.\n5. `curl` receives response.\n6. `Celery` calls :code:`echo`\n\n\nExtra\n=====\n\nPreprocessor\n------------\n\npreprocessor is optional. if you don't need it, you can:\n\n.. code-block:: python\n\n @app.task()\n def echo(text: str) -> None:\n print(text)\n\nAlso you can give multiple preprocessor:\n\n.. code-block:: python\n\n @app.task(two_times, two_times)\n def echo(text: str) -> None:\n print(text)\n\n\nlogging\n-------\n\nParsely uses logger witch named \"parsely\", so you can set log level like:\n\n.. code-block:: python\n\n import logging\n\n\n parsely_logger = logging.getLogger('parsely')\n parsely_logger.setLevel(logging.DEBUG)\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/narusemotoki/parsely", "keywords": "celery", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "parsely", "package_url": "https://pypi.org/project/parsely/", "platform": "", "project_url": "https://pypi.org/project/parsely/", "project_urls": { "Homepage": "https://github.com/narusemotoki/parsely" }, "release_url": "https://pypi.org/project/parsely/0.7.0/", "requires_dist": null, "requires_python": "", "summary": "Parsely is a framework for enqueuing messages via HTTP request for Celery.", "version": "0.7.0" }, "last_serial": 3204147, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "87c3eb11b1bf0cc6863b1ed10857eba8", "sha256": "5d2ccc2a6020b5c946ed72a47964376702b7b5127bb9d0ca156cf705d16d5c70" }, "downloads": -1, "filename": "parsely-0.3.1.tar.gz", "has_sig": false, "md5_digest": "87c3eb11b1bf0cc6863b1ed10857eba8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10682, "upload_time": "2017-09-14T12:21:52", "url": "https://files.pythonhosted.org/packages/60/a6/3b8d141b22bc2c5418dc6387e5094dadc71a7f9bf38421d4e3abd9f2430c/parsely-0.3.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "dea440d0952b38257b1a48a339b10ee8", "sha256": "c0cff370e62f9f3dde22cf401710dba04c75cc4052fa6798d39e52ab20838108" }, "downloads": -1, "filename": "parsely-0.5.0.tar.gz", "has_sig": false, "md5_digest": "dea440d0952b38257b1a48a339b10ee8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10684, "upload_time": "2017-09-14T12:22:44", "url": "https://files.pythonhosted.org/packages/24/66/3908f0175baef125701ed6f0b5e8cb44b28d0a9d18c955e74a072d8596ab/parsely-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "1b0d1926234b50f9de110c78072bd9e2", "sha256": "622468f4da3376953a026ad3982f41cda38d2a1ede8eac075f4c8450edb0b63b" }, "downloads": -1, "filename": "parsely-0.6.0.tar.gz", "has_sig": false, "md5_digest": "1b0d1926234b50f9de110c78072bd9e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10940, "upload_time": "2017-09-14T13:47:20", "url": "https://files.pythonhosted.org/packages/cd/cb/54a83f2a0bf5d98361a31518af1799e533d9aedfb476f2a00821070c451d/parsely-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "79667921284e92b9b3c4ef349f17a9d6", "sha256": "bebdf5b3653ecd5ee1b151663118bb1f450624afd069f26a79d18e3eda92d62b" }, "downloads": -1, "filename": "parsely-0.6.1.tar.gz", "has_sig": false, "md5_digest": "79667921284e92b9b3c4ef349f17a9d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11180, "upload_time": "2017-09-14T14:29:27", "url": "https://files.pythonhosted.org/packages/df/e5/c69a22c4e95a5ef5aef9e5986741b5425728c69e395a0f309da52aade0f5/parsely-0.6.1.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "75aff20fc117061cb2bbb91e4f887d77", "sha256": "557576d116e320fb68b576135746b4c95b02755a835fd8fcd4dbc57f112b5cbf" }, "downloads": -1, "filename": "parsely-0.7.0.tar.gz", "has_sig": false, "md5_digest": "75aff20fc117061cb2bbb91e4f887d77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2017-09-26T14:40:43", "url": "https://files.pythonhosted.org/packages/61/d3/b0bb9d6c98fcf300d825967796171ffdc891b3b11ed8ce72a659c9ae3431/parsely-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "75aff20fc117061cb2bbb91e4f887d77", "sha256": "557576d116e320fb68b576135746b4c95b02755a835fd8fcd4dbc57f112b5cbf" }, "downloads": -1, "filename": "parsely-0.7.0.tar.gz", "has_sig": false, "md5_digest": "75aff20fc117061cb2bbb91e4f887d77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2017-09-26T14:40:43", "url": "https://files.pythonhosted.org/packages/61/d3/b0bb9d6c98fcf300d825967796171ffdc891b3b11ed8ce72a659c9ae3431/parsely-0.7.0.tar.gz" } ] }