{ "info": { "author": "Lucas Kahlert", "author_email": "lucas.kahlert@square-src.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development" ], "description": "=========\npynghttp2\n=========\n\n.. image:: https://badge.fury.io/py/pynghttp2.svg\n :target: https://badge.fury.io/py/pynghttp2\n :alt: PyPi Version\n\n.. image:: https://travis-ci.org/f3anaro/pynghttp2.svg?branch=master\n :target: https://travis-ci.org/f3anaro/pynghttp2\n :alt: Build Status\n\n.. image:: https://codecov.io/gh/f3anaro/pynghttp2/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/f3anaro/pynghttp2\n :alt: Code Coverage\n\n.. image:: https://readthedocs.org/projects/pynghttp2/badge/?version=latest\n :target: http://pynghttp2.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\npynghttp2 are simple asyncio Python bindings based on ctypes for the nghttp2_\nlibrary. The only thing you need is a ``libnghttp2`` version on your system.\n\nOn Debian-based systems you can install nghttp2 simply via apt:\n\n.. code:: bash\n\n apt-get install libnghttp2-14\n\nThe project was created in the context of a student work for an HTTP/2 protocol\ngateway in the \u00b5PCN_ project - an implementation of Delay-tolerant Networking\n(DTN) protocols.\n\n\nInstallation\n============\n\n.. code:: bash\n\n pip install pynghttp2\n\n\nExamples\n========\n\nHigh-Level API\n--------------\n\n.. code:: python\n\n from pynghttp2 import http2\n\n # GET request\n resp = await http2.get('http://localhost:64602/ping')\n\n content = await resp.text()\n assert content == 'pong'\n\n # POST request\n message = b\"Lorem ipsum dolorem\"\n resp = await http2.post('http://localhost:64602/echo', data=message)\n echo = await resp.read()\n assert echo == message\n\n\nClient Session\n--------------\n\n.. code:: python\n\n from pynghttp2 import ClientSession\n\n # Multiplex two requests\n async with ClientSession(host='localhost', port=64602) as session:\n stream1 = session.get('http://localhost:64602/stream')\n stream2 = session.get('http://localhost:64602/stream')\n\n await asyncio.gather(stream1.read(), stream2.read())\n\n\nServer Session\n--------------\n\n.. code:: python\n\n import asyncio\n from pynghttp2 import ServerSession\n\n async def handle_request(req):\n \"\"\"Echo the request body\"\"\"\n msg = await req.read()\n await req.response(200, data=msg)\n\n with ServerSession(host='localhost', port=8080) as session:\n while True:\n # Wait for next incoming request\n req = await session\n\n # Handle each request in its own task to be able to multiplex\n # multiple requests and responses\n asyncio.ensure_future(handle_request(req))\n\n\n.. _nghttp2: https://nghttp2.org/\n.. _\u00b5PCN: https://upcn.eu/", "description_content_type": "text/x-rst; charset=UTF-8", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/f3anaro/pynghttp2", "keywords": "HTTP/2 nghttp2 bindings asyncio ctypes", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pynghttp2", "package_url": "https://pypi.org/project/pynghttp2/", "platform": "POSIX/Unix", "project_url": "https://pypi.org/project/pynghttp2/", "project_urls": { "Bug Tracker": "https://github.com/f3anaro/pynghttp2/issues", "Documentation": "https://pynghttp2.readthedocs.io/", "Homepage": "https://github.com/f3anaro/pynghttp2", "Source Code": "https://github.com/f3anaro/pynghttp2/" }, "release_url": "https://pypi.org/project/pynghttp2/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "Asyncio bindings for libnghttp2 based on ctypes", "version": "0.3.1" }, "last_serial": 3926312, "releases": { "0.1.5": [ { "comment_text": "", "digests": { "md5": "be0ab5771cddc48027cc6feb478470bb", "sha256": "6677e68c759a1a2dcf8e311f27ed887096bd7fe709cc01c333eeacab65c63dbc" }, "downloads": -1, "filename": "pynghttp2-0.1.5.tar.gz", "has_sig": false, "md5_digest": "be0ab5771cddc48027cc6feb478470bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21647, "upload_time": "2018-05-21T11:52:32", "url": "https://files.pythonhosted.org/packages/7c/63/8fd8179e3c6759856f93cf75a19f8687e7678d59fd2a3751ad93760b80f8/pynghttp2-0.1.5.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "adec0e8959311ee67cadccb38ebd0e11", "sha256": "3b8ba914715c1b49a72bd39b0967cd127d765c5077a67b4237304b3d0436fde1" }, "downloads": -1, "filename": "pynghttp2-0.2.2.tar.gz", "has_sig": false, "md5_digest": "adec0e8959311ee67cadccb38ebd0e11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20804, "upload_time": "2018-05-25T16:12:42", "url": "https://files.pythonhosted.org/packages/15/f5/2bb062e509a91775e70dc1188fe13a870b7deffc27b034e83fcc964f4170/pynghttp2-0.2.2.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "60fd0344618d0ab9df33656fdb931bcd", "sha256": "6f8567cba77735981f0a56ba9315b59a743a8d892dcd1baac447b4093852c04b" }, "downloads": -1, "filename": "pynghttp2-0.3.1.tar.gz", "has_sig": false, "md5_digest": "60fd0344618d0ab9df33656fdb931bcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21844, "upload_time": "2018-06-03T21:26:51", "url": "https://files.pythonhosted.org/packages/00/f6/e9374dd5d7d207a78501ed6f4cbe9d8430486bdea2161a0a3a6792573922/pynghttp2-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "60fd0344618d0ab9df33656fdb931bcd", "sha256": "6f8567cba77735981f0a56ba9315b59a743a8d892dcd1baac447b4093852c04b" }, "downloads": -1, "filename": "pynghttp2-0.3.1.tar.gz", "has_sig": false, "md5_digest": "60fd0344618d0ab9df33656fdb931bcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21844, "upload_time": "2018-06-03T21:26:51", "url": "https://files.pythonhosted.org/packages/00/f6/e9374dd5d7d207a78501ed6f4cbe9d8430486bdea2161a0a3a6792573922/pynghttp2-0.3.1.tar.gz" } ] }