{ "info": { "author": "Shreyansh Khajanchi", "author_email": "hello@shreyanshja.in", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Flask-Firehose\n==============\n\nHTTP/2 Server Push for your Flask apps.\n\n\nInstallation\n------------\n\n.. code-block:: python\n\n pip install flask-firehose\n\n\nUsage\n-----\nInitialization\n~~~~~~~~~~~~~~\n\nDirect initialization:\n\n.. code-block:: python\n\n app = Flask(__name__)\n Firehose(app)\n\nWith application factories:\n\n.. code-block:: python\n\n firehose = Firehose()\n\n def create_app():\n app = Flask(__name__)\n firehose.init_app(app)\n return app\n\n\nPushing resources\n~~~~~~~~~~~~~~~~~\n\nLet the HTML template writer decide what to push:\n\n.. code-block:: jinja\n\n {% extends 'base.html' %}\n {% block body %}\n \n This is some document.\n {% endblock %}\n\n\nLet the backend developer decide what to push:\n\n.. code-block:: python\n\n from flask_firehose import push\n\n @app.route('/someroute')\n def render_someroute():\n push('/static/css/main.css', as='style', rel='preload')\n return render_template('some_template')\n\n\nTracking pushed resources\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIdeally, resources already pushed during a session shouldn't be pushed again. So, Flask-Firehose includes a simple utility class to track pushed resources using session variable 'h2-pushed'.\nAdditionally, Flask-Firehose can also work with external code to track pushed resources in case the provided implementation is unsuitable.\n\n.. code-block:: python\n\n class Custom_connector():\n\n def get_pushed(self):\n \"\"\"Returns a set of items that have been already pushed to client.\n\n Returns\n -------\n set\n Set of items that are pushed.\n\n \"\"\"\n # your code here\n\n def set_pushed(self, inset):\n \"\"\"Update client state after pushing more items at the end of request.\n\n Parameters\n ----------\n inset : set\n A set of URLs of pushed items.\n \"\"\"\n # your code here\n\n\nUsing custom connector with Firehose\n\n.. code-block:: python\n\n firehose = Firehose(connector=Custom_connector())\n firehose.init_app(app)\n\n\nConfigure NGINX\n---------------\n\n.. code-block:: nginx\n\n location = /myapp {\n proxy_pass http://upstream;\n http2_push_preload on;\n }\n\n\nRead more at: https://www.nginx.com/blog/nginx-1-13-9-http2-server-push/\n\n\nTesting\n-------\n\nTo initialize a development environment in ./venv:\n\n.. code-block:: bash\n\n make devenv\n\nTo run unit tests:\n\n.. code-block:: bash\n\n make test\n\nTo run integration testing with NGINX with docker:\n\n.. code-block:: bash\n\n make dockertest\n\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/shreyanshk/flask-firehose", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-Firehose", "package_url": "https://pypi.org/project/Flask-Firehose/", "platform": "any", "project_url": "https://pypi.org/project/Flask-Firehose/", "project_urls": { "Homepage": "https://github.com/shreyanshk/flask-firehose" }, "release_url": "https://pypi.org/project/Flask-Firehose/0.2.2/", "requires_dist": [ "Flask (>=0.10)" ], "requires_python": "", "summary": "HTTP/2 Server Push for your Flask apps.", "version": "0.2.2" }, "last_serial": 4764824, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "e8c0c812eebc50ce53815843882267db", "sha256": "8d05bf80e7d4fe2eed806823072ac6d5f8ea61722c6e9ad9d3ede7c93c88b2bd" }, "downloads": -1, "filename": "Flask_Firehose-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e8c0c812eebc50ce53815843882267db", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3367, "upload_time": "2018-03-08T17:09:47", "url": "https://files.pythonhosted.org/packages/52/37/89c4b21c1005a9bff10d9f79cb6be5a3268890a439e1084fa6efa50db4a3/Flask_Firehose-0.2.1-py3-none-any.whl" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "08efebc134b4e418c62b96f61f4f3b6a", "sha256": "09c1d3870962212c4f8228242cac8ce3b6237e2aaf1e61331ad753f2cb049c5f" }, "downloads": -1, "filename": "Flask_Firehose-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "08efebc134b4e418c62b96f61f4f3b6a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4144, "upload_time": "2019-01-31T18:23:39", "url": "https://files.pythonhosted.org/packages/ee/05/e74b5020e25c19e6cbe8c04f7e910977d953172c6e8fe2f608b6b2eeb062/Flask_Firehose-0.2.2-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08efebc134b4e418c62b96f61f4f3b6a", "sha256": "09c1d3870962212c4f8228242cac8ce3b6237e2aaf1e61331ad753f2cb049c5f" }, "downloads": -1, "filename": "Flask_Firehose-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "08efebc134b4e418c62b96f61f4f3b6a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4144, "upload_time": "2019-01-31T18:23:39", "url": "https://files.pythonhosted.org/packages/ee/05/e74b5020e25c19e6cbe8c04f7e910977d953172c6e8fe2f608b6b2eeb062/Flask_Firehose-0.2.2-py2.py3-none-any.whl" } ] }