{ "info": { "author": "Iv\u00e1n de Paz Centeno", "author_email": "ipazc@unileon.es", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Natural Language :: English", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "=============\nFlasked 0.0.4\n=============\n\n`Flasked` is a package designed to ease the creation of a REST API. It uses `Flask` and `Flask-Restful` in the\nbackground.\n\n.. image:: https://badge.fury.io/py/flasked.svg\n :target: https://badge.fury.io/py/flasked\n\n\nExample\n=======\n\nHow to create a RESTFUL API faster than this?\n\n.. code:: python\n\n from flasked import Flasked\n\n class Root():\n def get(self):\n return \"This is the result\"\n\n flasked = Flasked()\n flasked[\"/\"] = Root\n flasked.run()\n\n\nInstallation\n============\n\nIt is only supported **Python 3.4.1** onwards:\n\n.. code:: bash\n\n sudo pip3 install flasked\n\n\nDescription\n===========\n\n`Flasked` behaves like a Python's dict; thus, in order to create more entry points, it is only required to assign the\nroute with the class that manages the route. Example:\n\n.. code:: python\n\n flasked[\"/\"] = RouteRoot\n flasked[\"/route2/\"] = Route2\n flasked[\"/route2//\"] = Route3\n\n\nThe routes available can be iterated in the same way as a Python's dict:\n\n.. code:: python\n \n print(list(flasked.keys()))\n \n for route in flasked:\n print(route)\n \n for route, cls in flasked.items():\n print(\"{}: {}\".format(route, cls))\n\n\nThe classes that manages the routes *do not require* to inherit from any special class, since `Flasked` is able to manage them.\nNonetheless, they have access to all the methods and attributes that a `Resource `_ class has (from `Flask_Restful `_).\n\n\nThe HTTP methods are defined as method from the class that handles it:\n\n.. code:: python\n\n class Root():\n def get(self):\n return {\"result\": \"result for GET\"}\n\n def post(self):\n return {\"result\": \"result for POST\"}\n\n def delete(self):\n return {\"result\": \"result for DELETE\"}\n\n\nAlso, when a variable is defined in an entry URL, the class method's need to reflect it:\n\n.. code:: python\n\n class Route3():\n def get(self, variable):\n return variable\n\n flasked[\"/route2//\"] = Route3\n\n\nIn order to run flask, it is only required to execute the `run()` method. It has the same arguments as a `Flask app run()`:\n\n.. code:: python\n\n flasked.run(host=\"0.0.0.0\", port=2234, threaded=True, debug=False)\n\n\nThe flask_restful API object and the Flask original APP object are directly accessible from the `flasked` object\n\n.. code:: python\n\n # Flask_Restful API object\n api = flasked.api\n\n # Flask API object\n flask_app = flasked.flask_app\n\n\nADVANCED\n========\n\nIf the class that manages a route requires arguments to be injected in the constructor, it can be done in the following way:\n\n.. code:: python\n\n class Route():\n def __init__(self, argument1, argument2):\n self.argument1 = argument1\n self.argument2 = argument2\n\n def get(self, variable):\n return variable\n\n # The following 3 lines do the same:\n flasked[\"/\"] = Route, argument1, argument2 # First way\n flasked[\"/\"] = Route, {'args': [argument1, argument2]} # Second way\n flasked[\"/\"] = Route, {'kwargs': dict(argument1=argument1, argument2=argument2)} # third way\n\n\n**IMPORTANT:** Note that if the first way is taken, the `argument1` **can't be a dictionary that contains the keywords 'args' or 'kwargs'**.\nOtherwise, it will be used as a source for the `args` and `kwargs` of the initializer. It is always preferred to use the second mixed with the third way.\n\nThis package is completely compatible with flask_restful. For more information, check `Flask_Restful `_.\n\n\nBASIC USE CASES\n===============\n\nBasic usage examples are shown in the `Usage-examples page from the wiki `_:\n\n * `How to create endpoints with different methods `_\n * `How to read a json from the request `_\n * `How to read a request parameter `_\n * `How to read a request URL value `_\n * `How to retrieve a file from the request `_\n * `How to return a file as response `_\n\n\nMANUAL TESTING\n==============\n\nIf you want to test your API REST manually, there's an explanation on how to do it in this `wiki page `_\n\nLICENSE\n=======\n\nIt is released under the *MIT license*.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ipazc/flasked", "keywords": "flask rest API easy dict", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flasked", "package_url": "https://pypi.org/project/flasked/", "platform": "", "project_url": "https://pypi.org/project/flasked/", "project_urls": { "Homepage": "http://github.com/ipazc/flasked" }, "release_url": "https://pypi.org/project/flasked/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Flasked is a package for creating an API-REST even easier than with Flask_Restful.", "version": "0.0.4" }, "last_serial": 3474521, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "20a8d7241cfb4b891be86c7694fe9f4b", "sha256": "afb49dc357463a88151f5837e4e0297db88e8c8f3a30156440dd861392473c46" }, "downloads": -1, "filename": "flasked-0.0.1.tar.gz", "has_sig": false, "md5_digest": "20a8d7241cfb4b891be86c7694fe9f4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4389, "upload_time": "2017-11-15T10:32:29", "url": "https://files.pythonhosted.org/packages/0b/5b/f9bad76853a90ef64f49d08608ecb969fbb512525b38bcc692377cacd07b/flasked-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "139212d8a753e3ba87c625a989b0a882", "sha256": "1cc825af971089210cfa133fc323ac3856ee6acba85071d9bca76629f1555e37" }, "downloads": -1, "filename": "flasked-0.0.2.tar.gz", "has_sig": false, "md5_digest": "139212d8a753e3ba87c625a989b0a882", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4502, "upload_time": "2017-12-13T17:05:20", "url": "https://files.pythonhosted.org/packages/0b/36/2b5934c0f9fdf24a007ef3d120fb43fe9314f5407b05571e9cfe16bf0fe8/flasked-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "1463d4299b5d77332f2cae31533ca17f", "sha256": "41a4f6d0f00a0aaf4b8777f800e4b253f7f3219db47894bbfdacfcd0d41d532f" }, "downloads": -1, "filename": "flasked-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1463d4299b5d77332f2cae31533ca17f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4888, "upload_time": "2017-12-19T15:49:44", "url": "https://files.pythonhosted.org/packages/4a/c6/12cef5dfc2e48410de981ec7dcf7f5cd1988e7b09162761c100e36e459b4/flasked-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "b9a22724f6dcf1191fbe2bd35c90cd44", "sha256": "7a5047ba8b72599f7be0e28432ac55a91d76f7ed1f00c81669297f0d878eebac" }, "downloads": -1, "filename": "flasked-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b9a22724f6dcf1191fbe2bd35c90cd44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4885, "upload_time": "2018-01-09T15:25:50", "url": "https://files.pythonhosted.org/packages/20/89/f7ef8b25d65c2de2adff5e280c7a5fa32a1fbae41dae510415b6e66a96ec/flasked-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b9a22724f6dcf1191fbe2bd35c90cd44", "sha256": "7a5047ba8b72599f7be0e28432ac55a91d76f7ed1f00c81669297f0d878eebac" }, "downloads": -1, "filename": "flasked-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b9a22724f6dcf1191fbe2bd35c90cd44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4885, "upload_time": "2018-01-09T15:25:50", "url": "https://files.pythonhosted.org/packages/20/89/f7ef8b25d65c2de2adff5e280c7a5fa32a1fbae41dae510415b6e66a96ec/flasked-0.0.4.tar.gz" } ] }