{ "info": { "author": "Jahongir Rahmonov", "author_email": "jrahmonov2@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3.6" ], "description": "\n# Bumbo: Python Web Framework built for learning purposes\n\n\n\n\nBumbo is a Python web framework built for learning purposes.\n\nIt's a WSGI framework and can be used with any WSGI application server such as Gunicorn.\n\n## Installation\n\n```shell\npip install bumbo\n```\n\n## How to use it\n\n### Basic usage:\n\n```python\nfrom bumbo.api import API\n\napp = API()\n\n\n@app.route(\"/home\")\ndef home(request, response):\n response.text = \"Hello from the HOME page\"\n\n\n@app.route(\"/hello/{name}\")\ndef greeting(request, response, name):\n response.text = f\"Hello, {name}\"\n\n\n@app.route(\"/book\")\nclass BooksResource:\n def get(self, req, resp):\n resp.text = \"Books Page\"\n\n def post(self, req, resp):\n resp.text = \"Endpoint to create a book\"\n\n\n@app.route(\"/template\")\ndef template_handler(req, resp):\n resp.body = app.template(\n \"index.html\", context={\"name\": \"Bumbo\", \"title\": \"Best Framework\"}).encode()\n```\n\n### Unit Tests\n\nThe recommended way of writing unit tests is with [pytest](https://docs.pytest.org/en/latest/). There are two built in fixtures\nthat you may want to use when writing unit tests with Bumbo. The first one is `app` which is an instance of the main `API` class:\n\n```python\ndef test_route_overlap_throws_exception(app):\n @app.route(\"/\")\n def home(req, resp):\n resp.text = \"Welcome Home.\"\n\n with pytest.raises(AssertionError):\n @app.route(\"/\")\n def home2(req, resp):\n resp.text = \"Welcome Home2.\"\n```\n\nThe other one is `client` that you can use to send HTTP requests to your handlers. It is based on the famous [requests](http://docs.python-requests.org/en/master/) and it should feel very familiar:\n\n```python\ndef test_parameterized_route(app, client):\n @app.route(\"/{name}\")\n def hello(req, resp, name):\n resp.text = f\"hey {name}\"\n\n assert client.get(\"http://testserver/matthew\").text == \"hey matthew\"\n```\n\n## Templates\n\nThe default folder for templates is `templates`. You can change it when initializing the main `API()` class:\n\n```python\napp = API(templates_dir=\"templates_dir_name\")\n```\n\nThen you can use HTML files in that folder like so in a handler:\n\n```python\n@app.route(\"/show/template\")\ndef handler_with_template(req, resp):\n resp.html = app.template(\n \"example.html\", context={\"title\": \"Awesome Framework\", \"body\": \"welcome to the future!\"})\n```\n\n## Static Files\n\nJust like templates, the default folder for static files is `static` and you can override it:\n\n```python\napp = API(static_dir=\"static_dir_name\")\n```\n\nThen you can use the files inside this folder in HTML files:\n\n```html\n\n\n\n
\n \nThis is a paragraph
\n\n\n```\n\n### Middleware\n\nYou can create custom middleware classes by inheriting from the `bumbo.middleware.Middleware` class and overriding its two methods\nthat are called before and after each request:\n\n```python\nfrom bumbo.api import API\nfrom bumbo.middleware import Middleware\n\n\napp = API()\n\n\nclass SimpleCustomMiddleware(Middleware):\n def process_request(self, req):\n print(\"Before dispatch\", req.url)\n\n def process_response(self, req, res):\n print(\"After dispatch\", req.url)\n\n\napp.add_middleware(SimpleCustomMiddleware)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "bumbo", "package_url": "https://pypi.org/project/bumbo/", "platform": "", "project_url": "https://pypi.org/project/bumbo/", "project_urls": null, "release_url": "https://pypi.org/project/bumbo/0.0.13/", "requires_dist": [ "Jinja2 (==2.10.1)", "requests-wsgi-adapter (==0.4.1)", "parse (==1.12.0)", "requests (==2.22.0)", "WebOb (==1.8.5)", "whitenoise (==4.1.2)" ], "requires_python": ">=3.6.0", "summary": "Bumbo Python Web Framework built for learning purposes.", "version": "0.0.13" }, "last_serial": 5934785, "releases": { "0.0.12": [ { "comment_text": "", "digests": { "md5": "824c24e5e8d5daa478aff046358da72b", "sha256": "5d928750c4862a35fbe84182e6c6cf1835079ea2811a385efdbf4b2b0797feba" }, "downloads": -1, "filename": "bumbo-0.0.12-py3-none-any.whl", "has_sig": false, "md5_digest": "824c24e5e8d5daa478aff046358da72b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 3477, "upload_time": "2019-10-06T12:40:55", "url": "https://files.pythonhosted.org/packages/53/df/0bb416605c22687d7209c85435add9c4f89d556569ffebbe447335491d89/bumbo-0.0.12-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "761fb2f26dd025ed755e92af8a374c93", "sha256": "4535301c0e5f6fa12e903e5bdd6c92c4b4ccd70c44921054d9b97025cfd35eb5" }, "downloads": -1, "filename": "bumbo-0.0.12.tar.gz", "has_sig": false, "md5_digest": "761fb2f26dd025ed755e92af8a374c93", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 3057, "upload_time": "2019-10-06T12:40:57", "url": "https://files.pythonhosted.org/packages/79/99/da70f815b4692a4d42e5ccb81ceb43ea603e6630b983b5ba359b68a64862/bumbo-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "98b82b033a68f95369675029e4d6fe18", "sha256": "085cd604f559f89cf9b3e54d7e7165782f9a712150a9c399405876c9dfbeb4bb" }, "downloads": -1, "filename": "bumbo-0.0.13-py3-none-any.whl", "has_sig": false, "md5_digest": "98b82b033a68f95369675029e4d6fe18", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 4884, "upload_time": "2019-10-06T12:46:43", "url": "https://files.pythonhosted.org/packages/6b/a5/cc94308f3b52b86b14688ede1b0c9f15275cb5777b47b2c196d564ba5dd5/bumbo-0.0.13-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc8ee7fc7f730c5bce8437d6eb8b17f0", "sha256": "5f44d8e91dfef8f97b0c9ea7c4b0e54a4333525eeaff14731c22dd785aa3b1cd" }, "downloads": -1, "filename": "bumbo-0.0.13.tar.gz", "has_sig": false, "md5_digest": "bc8ee7fc7f730c5bce8437d6eb8b17f0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4874, "upload_time": "2019-10-06T12:46:45", "url": "https://files.pythonhosted.org/packages/4f/ca/a34359e625dadb44368f5e26db83534cac5c7583047bcb60580e4edace8d/bumbo-0.0.13.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "66ab788e0c7ed377e308b45848f42723", "sha256": "ccd6580ee3feb676aafa202eaeb316d739262c707aa6bb137728dd603d22ea12" }, "downloads": -1, "filename": "bumbo-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "66ab788e0c7ed377e308b45848f42723", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 4291, "upload_time": "2019-05-30T05:47:59", "url": "https://files.pythonhosted.org/packages/af/6d/1edb3c34620b54007f88ac48cfc98a94e37a4118f3ccd9b6c6675a5192d8/bumbo-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "10815af04962b26d5c888ff4a65d237d", "sha256": "ceb4d0afc9f2a998588314f80c7d503c67b9f412791b291f0f84b4744aed4561" }, "downloads": -1, "filename": "bumbo-0.0.2.tar.gz", "has_sig": false, "md5_digest": "10815af04962b26d5c888ff4a65d237d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4535, "upload_time": "2019-05-30T05:48:00", "url": "https://files.pythonhosted.org/packages/6b/26/c92b2a6abb3e75d6899a089b4290f6a1652a51ea026e61858731909040d4/bumbo-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "5819792a08c3b06b044d2310516d556e", "sha256": "21f0a852604cff4db2921f158dc3a01dd18694731f9db59e52d80f0ca0bc1c56" }, "downloads": -1, "filename": "bumbo-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5819792a08c3b06b044d2310516d556e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 4927, "upload_time": "2019-06-03T11:28:50", "url": "https://files.pythonhosted.org/packages/86/d6/78e6e7d975927945603202ddc6a894f2e38d2cfb1d553b9f0235df7a7ce7/bumbo-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "201654a959ec7af91e723149a8610a81", "sha256": "9283c891a4ab50a3aa4f5e4999ff1759e47c9a8a604f8258c5eed3ee8a74c7e8" }, "downloads": -1, "filename": "bumbo-0.0.3.tar.gz", "has_sig": false, "md5_digest": "201654a959ec7af91e723149a8610a81", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4907, "upload_time": "2019-06-03T11:28:52", "url": "https://files.pythonhosted.org/packages/d8/4b/543cef28d921899482d5f2fde7f05bb54872681508ebe2703a6d4dee73d6/bumbo-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "98b82b033a68f95369675029e4d6fe18", "sha256": "085cd604f559f89cf9b3e54d7e7165782f9a712150a9c399405876c9dfbeb4bb" }, "downloads": -1, "filename": "bumbo-0.0.13-py3-none-any.whl", "has_sig": false, "md5_digest": "98b82b033a68f95369675029e4d6fe18", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 4884, "upload_time": "2019-10-06T12:46:43", "url": "https://files.pythonhosted.org/packages/6b/a5/cc94308f3b52b86b14688ede1b0c9f15275cb5777b47b2c196d564ba5dd5/bumbo-0.0.13-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc8ee7fc7f730c5bce8437d6eb8b17f0", "sha256": "5f44d8e91dfef8f97b0c9ea7c4b0e54a4333525eeaff14731c22dd785aa3b1cd" }, "downloads": -1, "filename": "bumbo-0.0.13.tar.gz", "has_sig": false, "md5_digest": "bc8ee7fc7f730c5bce8437d6eb8b17f0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4874, "upload_time": "2019-10-06T12:46:45", "url": "https://files.pythonhosted.org/packages/4f/ca/a34359e625dadb44368f5e26db83534cac5c7583047bcb60580e4edace8d/bumbo-0.0.13.tar.gz" } ] }