{
"info": {
"author": "Rafael Caricio",
"author_email": "sticker-dev@caric.io",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 2 - Pre-Alpha",
"Framework :: AsyncIO",
"Framework :: Bottle",
"Framework :: Flask",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Server",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "\n.. image:: https://github.com/rafaelcaricio/sticker/raw/master/docs/images/sticker_logo.png\n :align: center\n :alt: Sticker\n :target: https://github.com/rafaelcaricio/sticker\n\n|\n\n.. image:: https://img.shields.io/pypi/v/sticker.svg\n :target: https://pypi.python.org/pypi/sticker\n\n.. image:: https://img.shields.io/pypi/l/sticker.svg\n :target: https://pypi.python.org/pypi/sticker\n\n.. image:: https://img.shields.io/pypi/pyversions/sticker.svg\n :target: https://pypi.python.org/pypi/sticker\n\n.. image:: https://img.shields.io/github/contributors/rafaelcaricio/sticker.svg\n :target: https://github.com/rafaelcaricio/sticker/graphs/contributors\n\nWrite boilerplate-free Python functions and use them as your API handlers.\nSticker allows you to choose Flask, bottle.py, Sanic, or Tornado as your\napplication runtime.\n\n**Highlights**:\n\n* Community created and maintained\n* Support for `OpenAPI 3.0 `_\n* Multi-framework support: `Flask `_, `bottle.py `_, `Sanic `_, and `Tornado `_\n* Support for **pure Python handlers** (no boilerplate code)\n\nIt's Easy to Write\n==================\n\nYou need a little bit of Python.\n\n.. code-block:: python\n\n def say_hello(params):\n return {\"contents\": \"Hello World!\"}\n\nPlus bits of your API description.\n\n.. code-block:: YAML\n\n openapi: \"3.0.0\"\n paths:\n /:\n get:\n operationId: hello.say_hello\n\nNow the fun part, you choose which web framework you want to use.\n\nRun with Flask:\n\n.. code-block:: python\n\n from sticker import FlaskAPI\n api = FlaskAPI('hello.yml')\n api.get_app(__name__).run()\n\nRun with Bottle.py:\n\n.. code-block:: python\n\n from sticker import BottleAPI\n api = BottleAPI('hello.yml')\n api.run()\n\nRun with Sanic:\n\n.. code-block:: python\n\n from sticker import SanicAPI\n api = SanicAPI('hello.yml')\n api.get_app(__name__).run()\n\nRun with Tornado:\n\n.. code-block:: python\n\n from sticker import TornadoAPI\n import tornado.ioloop\n api = TornadoAPI('hello.yml')\n api.get_app().listen(8888)\n tornado.ioloop.IOLoop.current().start()\n\nThe framework setup, validation, types conversion, and mocking is handled at runtime by Sticker.\n\n\u2728\n\nInstallation\n============\n\nSticker is published at PyPI, so you can use ``pip`` to install:\n\n.. code-block:: bash\n\n $ pip install sticker\n\nRequirements\n============\n\nSticker was developed for **Python >=3.6** and **OpenAPI 3.0**. Support for Python 2.7 is not present nor planned for this project.\n\nDocumentation\n=============\n\nSticker is a flexible metaframework for Web API development and execution. The OpenAPI 3.0 standard is used as\ndescription format for Sticker powered APIs. You provide the API specification and choose one of the\nSticker's runtimes to have a webserver up and running.\n\nIn this document we will describe a few different ways to write code that works well with Sticker.\n\nPure Python Handlers\n--------------------\n\nSticker supports the use of pure Python functions as handlers. Your code will be free of any framework\nspecific boilerplate code, including Sticker's itself. This allows you to swap between different frameworks\nas you wish. Sticker will take care of putting together your code, your API, and the framework you choose.\n\n.. code-block:: python\n\n def myhandler(params):\n return {\n \"content\": f\"Hello {params.get(\"name\", \"World\")}!\",\n \"status\": 200\n }\n\nWriting tests for pure Python handles is easy and also\nfree of boilerplate code.\n\n.. code-block:: python\n\n def test_myhandler():\n params = {\n \"name\": \"John Doe\"\n }\n response = myhandler(params)\n assert response[\"content\"] == \"Hello John Doe!\"\n\nAs you could see in the example above, no imports from Sticker were necessary to define the API handler function.\nThis is only possible because Sticker expects your handlers to follow a code convention.\n\nAnatomy Of An API Handler Function\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nWrite this part.\n\nResponses\n^^^^^^^^^\n\nAPI handlers are expected to return a Python dictionary (``dict``) object. The returned dictionary defines how a response\nwill look like. All keys in the dictionary are optional. The expected keys are described in the table bellow.\n\n=========== ======================== ===========\nKey Type Description\n=========== ======================== ===========\ncontent str Body of HTTP request. No treatment/parsing of this value is done. The value is passed directly to the chosen framework.\njson Union[dict, List[dict]] JSON value to be used in the body of the request. This is a shortcut to having the header \"Content-Type: application/json\" and serializing this value using the most common way done by the chosen framework.\nfile Union[IO[AnyStr], str] Data to be returned as byte stream. This is a shortcut for having the header \"Content-Type: application/octet-stream\". Uses the most common way to stream files with the chosen framework.\nredirect str The path or full URL to be redirected. This is a shortcut for having the header \"Location:\" with HTTP status `301`.\nstatus int The HTTP status code to be used in the response. This value overrides any shortcut default status code.\nheaders Dict[str, str] The HTTP headers to be used in the response. This value is merged with the shortcut values with priority.\n=========== ======================== ===========\n\n\nWe have exposed here some examples of using different configurations of the ``dict`` we've defined above to describe the\nHTTP response of API handlers. The actual HTTP response value generated will vary depending on the framework chosen as\nruntime. The examples are a minimal illustration of what to expect to be the HTTP response.\n\nThe \"content\" key can be used when it's desired to return a \"Hello world!\" string with status ``200``.\n\n.. code-block:: python\n\n def say_hello(params):\n return {\"content\": \"Hello world!\"}\n\nResults in the HTTP response similar to:\n\n.. code-block::\n\n HTTP/1.1 200 OK\n Content-Type: text/plain\n\n Hello world!\n\nThe \"json\" key can be used when desired to return an JSON response with status ``201``.\n\n.. code-block:: python\n\n def create(params):\n data = {\n \"id\": \"uhHuehuE\",\n \"value\": \"something\"\n }\n return {\"json\": data, \"status\": 201}\n\nThe HTTP response generated will be similar to:\n\n.. code-block::\n\n HTTP/1.1 201 Created\n Content-Type: application/json\n\n {\"id\":\"uhHuehuE\",\"value\":\"something\"}\n\nThe \"file\" key is used to return file contents.\n\n.. code-block:: python\n\n def homepage(params):\n return {\n \"file\": open('templates/home.html', 'r'),\n \"headers\": {\n \"Content-Type\": \"text/html\"\n }\n }\n\nThe HTTP response will be similar to:\n\n.. code-block::\n\n HTTP/1.1 200 OK\n Content-Type: text/html\n\n My homepageWelcome!
\n\nWhen necessary to redirect request, the \"redirect\" key can be used.\n\n.. code-block:: python\n\n def old_endpoint(params):\n return {'redirect': '/new-path'}\n\nThe HTTP response will be similar to:\n\n.. code-block::\n\n HTTP/1.1 301 Moved Permanently\n Location: https://example.com/new-path\n\nThe usage of keys \"status\" and \"headers\" were shown in the previous examples. The \"status\" and \"headers\" keys, when set,\noverride the values set by default when using the shortcut keys (\"json\", \"file\", and \"redirect\").\n\nError Handling\n--------------\n\nSticker expects you to define the error format to be returned by your API. A error handler is configurable,\nand called every time validation for the endpoint fails.\n\n.. code-block:: python\n\n def error_handler(error):\n return {\n \"content\": {\n \"error\": error[\"message\"]\n },\n \"headers\": {\n \"Content-Type\": \"application/json\"\n },\n \"status_code\": 400\n }\n\nContributing\n============\n\nSticker is developed under the `Apache 2.0 license `_\nand is publicly available to everyone. We are happy to accept contributions.\n\nHow to Contribute\n-----------------\n\n#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a `Good First Issue`_ tag for issues that should be ideal for people who are not very familiar with the codebase yet.\n#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).\n#. Write a test which shows that the bug was fixed or that the feature works as expected.\n#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.\n\n.. _`the repository`: https://github.com/rafaelcaricio/sticker\n.. _AUTHORS: https://github.com/rafaelcaricio/sticker/blob/master/AUTHORS.rst\n.. _Good First Issue: https://github.com/rafaelcaricio/sticker/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22\n\n\n",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/rafaelcaricio/sticker",
"keywords": "",
"license": "Apache 2.0",
"maintainer": "",
"maintainer_email": "",
"name": "sticker",
"package_url": "https://pypi.org/project/sticker/",
"platform": "",
"project_url": "https://pypi.org/project/sticker/",
"project_urls": {
"Homepage": "https://github.com/rafaelcaricio/sticker"
},
"release_url": "https://pypi.org/project/sticker/0.0.5/",
"requires_dist": [
"pyyaml",
"bottle (>=0.12.13); extra == 'bottle'",
"flask (>=0.12.2); extra == 'flask'",
"sanic (>=0.7.0); extra == 'sanic'",
"tornado (>=5.0.1); extra == 'tornado'"
],
"requires_python": ">=3.6.0",
"summary": "Sticker is a powerful yet boilerplate-free alternative to writing your web API.",
"version": "0.0.5"
},
"last_serial": 3716446,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "6e2de784896628be0ef143ad86b0401f",
"sha256": "03f47acfb738a567d1b4f2a3a231f24cdbb9aee061b7f8d08429aecb72584272"
},
"downloads": -1,
"filename": "sticker-0.0.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "6e2de784896628be0ef143ad86b0401f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 5921,
"upload_time": "2018-03-26T19:07:59",
"url": "https://files.pythonhosted.org/packages/33/72/21f0b7a1920785edb49a09cf3b916ee96c4c8d5a51fb7ad8f70dbd0f4987/sticker-0.0.1-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "926421c6b7c991079942f7c1f78ac7ca",
"sha256": "e38951f769cb4553951b87d111c0d357d3f1a87fa1039e152169809ed41d5a07"
},
"downloads": -1,
"filename": "sticker-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "926421c6b7c991079942f7c1f78ac7ca",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 8597,
"upload_time": "2018-03-26T19:08:01",
"url": "https://files.pythonhosted.org/packages/1a/92/a71a8ecb00bc58049b79780611e0874ac4622dc8c40ffef0777561fdeecb/sticker-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "60eacdd9dd316907760650484d54a82b",
"sha256": "dda62855c7eb28e2f12aadd1cec7e561dd134bb97ceb9d4a5ba5e10b3700cfda"
},
"downloads": -1,
"filename": "sticker-0.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "60eacdd9dd316907760650484d54a82b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 8771,
"upload_time": "2018-03-27T21:26:10",
"url": "https://files.pythonhosted.org/packages/fb/c9/e4091e43ddbb55974291221ef8aa3ea6ed51ba001da7310c792da5816556/sticker-0.0.2-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "d70e412055fc4e0f995d9401ce2df32b",
"sha256": "aa3c3f6a3bf6188815042415ebb03df8f818f22452822944b8ddec5260d040bc"
},
"downloads": -1,
"filename": "sticker-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "d70e412055fc4e0f995d9401ce2df32b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 10406,
"upload_time": "2018-03-27T21:26:12",
"url": "https://files.pythonhosted.org/packages/06/78/60916360773f3adc53634d77ef67cea25382ab34c8c6dd98a468cfb48a62/sticker-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "262eed7beb4bbea61020860ed13b9809",
"sha256": "7d3200996db3caf1d2c4c5714a0b4cde139573155eacd1a6bac478d0004f3861"
},
"downloads": -1,
"filename": "sticker-0.0.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "262eed7beb4bbea61020860ed13b9809",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 9963,
"upload_time": "2018-03-28T21:39:36",
"url": "https://files.pythonhosted.org/packages/e3/69/8b0c6c4e90cecd52970710764b11640bc3e789d545066c5a76598ed0fa1b/sticker-0.0.3-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "7cff1496cb8b17354a75fd4b59780abf",
"sha256": "e5e9cf19817dfcfe8b02198e2073df5cb78caf518e6d9ed53da3b3b60fdc233f"
},
"downloads": -1,
"filename": "sticker-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "7cff1496cb8b17354a75fd4b59780abf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 11084,
"upload_time": "2018-03-28T21:39:37",
"url": "https://files.pythonhosted.org/packages/5a/2e/a36bca6b99bc09c6e8dbfae1019d0ee50a1426a5d0e3953069ef6d8b64dc/sticker-0.0.3.tar.gz"
}
],
"0.0.4": [
{
"comment_text": "",
"digests": {
"md5": "5b7ff55de97c4d402cd725975088895a",
"sha256": "75ef4ad88df16404ed2d29c1b3da4a0492c22e7b6cd51b934e0eec839273ba6c"
},
"downloads": -1,
"filename": "sticker-0.0.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b7ff55de97c4d402cd725975088895a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 9970,
"upload_time": "2018-03-29T08:32:21",
"url": "https://files.pythonhosted.org/packages/a7/14/49dd7db7234a6617d10d810f1712bbf572fe7ae589d2e45846768aa730dc/sticker-0.0.4-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "b1c04530b199b245c4ee80c4522d3b93",
"sha256": "95e167a3ef46f44aa100056d2cf2a0b53d9249c90bbb6fd2f66d61d4a3eca16d"
},
"downloads": -1,
"filename": "sticker-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "b1c04530b199b245c4ee80c4522d3b93",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 11967,
"upload_time": "2018-03-29T08:32:22",
"url": "https://files.pythonhosted.org/packages/e4/43/f7790d4785de90bbeb1a7a0237f42c70b25ac0428ebebe2d859a88cecec5/sticker-0.0.4.tar.gz"
}
],
"0.0.5": [
{
"comment_text": "",
"digests": {
"md5": "d6c881b3bba8445b04b710bcf66625e8",
"sha256": "aad719c823de544d022515e1ec0118aa96acda89af3c3bef6bfd7f77c4a845a5"
},
"downloads": -1,
"filename": "sticker-0.0.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d6c881b3bba8445b04b710bcf66625e8",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 9945,
"upload_time": "2018-03-29T08:49:05",
"url": "https://files.pythonhosted.org/packages/82/37/747a589ce02821875fd0bb33980055d12ed1cf65cadb441b90d1244558f6/sticker-0.0.5-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c09fbbbd91396ad27592988b3063a19d",
"sha256": "20a29ec2e751476adccf7cad98ddf9e807d9c4dc943d55540fb67151b90a6a94"
},
"downloads": -1,
"filename": "sticker-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "c09fbbbd91396ad27592988b3063a19d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 11929,
"upload_time": "2018-03-29T08:49:06",
"url": "https://files.pythonhosted.org/packages/60/42/5e8937e5868cc526233d62cf31d9faf366dd9ad3c4252698e842a7661321/sticker-0.0.5.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d6c881b3bba8445b04b710bcf66625e8",
"sha256": "aad719c823de544d022515e1ec0118aa96acda89af3c3bef6bfd7f77c4a845a5"
},
"downloads": -1,
"filename": "sticker-0.0.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d6c881b3bba8445b04b710bcf66625e8",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.0",
"size": 9945,
"upload_time": "2018-03-29T08:49:05",
"url": "https://files.pythonhosted.org/packages/82/37/747a589ce02821875fd0bb33980055d12ed1cf65cadb441b90d1244558f6/sticker-0.0.5-py2.py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c09fbbbd91396ad27592988b3063a19d",
"sha256": "20a29ec2e751476adccf7cad98ddf9e807d9c4dc943d55540fb67151b90a6a94"
},
"downloads": -1,
"filename": "sticker-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "c09fbbbd91396ad27592988b3063a19d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 11929,
"upload_time": "2018-03-29T08:49:06",
"url": "https://files.pythonhosted.org/packages/60/42/5e8937e5868cc526233d62cf31d9faf366dd9ad3c4252698e842a7661321/sticker-0.0.5.tar.gz"
}
]
}