Code import
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
python-engineio
|
||||
===============
|
||||
|
||||
.. image:: https://travis-ci.org/miguelgrinberg/python-engineio.svg?branch=master
|
||||
:target: https://travis-ci.org/miguelgrinberg/python-engineio
|
||||
|
||||
Python implementation of the `Engine.IO`_ realtime server.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Fully compatible with the Javascript `engine.io-client`_ library, versions 1.5.0 and up.
|
||||
- Compatible with Python 2.7 and Python 3.3+.
|
||||
- Supports large number of clients even on modest hardware when used with an asynchronous server based on `asyncio`_(`sanic`_ or `aiohttp`_), `eventlet`_ or `gevent`_. For development and testing, any WSGI compliant multi-threaded server can be used.
|
||||
- Includes a WSGI middleware that integrates Engine.IO traffic with standard WSGI applications.
|
||||
- Uses an event-based architecture implemented with decorators that hides the details of the protocol.
|
||||
- Implements HTTP long-polling and WebSocket transports.
|
||||
- Supports XHR2 and XHR browsers as clients.
|
||||
- Supports text and binary messages.
|
||||
- Supports gzip and deflate HTTP compression.
|
||||
- Configurable CORS responses to avoid cross-origin problems with browsers.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
The following application uses the Eventlet asynchronous server, and includes a
|
||||
small Flask application that serves the HTML/Javascript to the client:
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
import engineio
|
||||
import eventlet
|
||||
import eventlet.wsgi
|
||||
from flask import Flask, render_template
|
||||
|
||||
eio = engineio.Server()
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
"""Serve the client-side application."""
|
||||
return render_template('index.html')
|
||||
|
||||
@eio.on('connect')
|
||||
def connect(sid, environ):
|
||||
print("connect ", sid)
|
||||
|
||||
@eio.on('message')
|
||||
def message(sid, data):
|
||||
print("message ", data)
|
||||
eio.send(sid, 'reply')
|
||||
|
||||
@eio.on('disconnect')
|
||||
def disconnect(sid):
|
||||
print('disconnect ', sid)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# wrap Flask application with engineio's middleware
|
||||
app = engineio.Middleware(eio, app)
|
||||
|
||||
# deploy as an eventlet WSGI server
|
||||
eventlet.wsgi.server(eventlet.listen(('', 8000)), app)
|
||||
|
||||
|
||||
And below is a similar example, coded for asyncio (Python 3.5+ only) with the
|
||||
`aiohttp`_ framework:
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
from aiohttp import web
|
||||
import engineio
|
||||
|
||||
eio = engineio.AsyncServer()
|
||||
app = web.Application()
|
||||
eio.attach(app)
|
||||
|
||||
async def index(request):
|
||||
"""Serve the client-side application."""
|
||||
with open('index.html') as f:
|
||||
return web.Response(text=f.read(), content_type='text/html')
|
||||
|
||||
@eio.on('connect')
|
||||
def connect(sid, environ):
|
||||
print("connect ", sid)
|
||||
|
||||
@eio.on('message')
|
||||
async def message(sid, data):
|
||||
print("message ", data)
|
||||
await eio.send(sid, 'reply')
|
||||
|
||||
@eio.on('disconnect')
|
||||
def disconnect(sid):
|
||||
print('disconnect ', sid)
|
||||
|
||||
app.router.add_static('/static', 'static')
|
||||
app.router.add_get('/', index)
|
||||
|
||||
if __name__ == '__main__':
|
||||
web.run_app(app)
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
- `Documentation`_
|
||||
- `PyPI`_
|
||||
|
||||
.. _Engine.IO: https://github.com/Automattic/engine.io
|
||||
.. _engine.io-client: https://github.com/Automattic/engine.io-client
|
||||
.. _asyncio: https://docs.python.org/3/library/asyncio.html
|
||||
.. _sanic: http://sanic.readthedocs.io/
|
||||
.. _aiohttp: http://aiohttp.readthedocs.io/
|
||||
.. _eventlet: http://eventlet.net/
|
||||
.. _gevent: http://gevent.org/
|
||||
.. _aiohttp: http://aiohttp.readthedocs.io/
|
||||
.. _Documentation: http://pythonhosted.org/python-engineio
|
||||
.. _PyPI: https://pypi.python.org/pypi/python-engineio
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,140 @@
|
||||
Metadata-Version: 2.0
|
||||
Name: python-engineio
|
||||
Version: 1.7.0
|
||||
Summary: Engine.IO server
|
||||
Home-page: http://github.com/miguelgrinberg/python-engineio/
|
||||
Author: Miguel Grinberg
|
||||
Author-email: miguelgrinberg50@gmail.com
|
||||
License: MIT
|
||||
Platform: any
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Dist: six (>=1.9.0)
|
||||
|
||||
python-engineio
|
||||
===============
|
||||
|
||||
.. image:: https://travis-ci.org/miguelgrinberg/python-engineio.svg?branch=master
|
||||
:target: https://travis-ci.org/miguelgrinberg/python-engineio
|
||||
|
||||
Python implementation of the `Engine.IO`_ realtime server.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Fully compatible with the Javascript `engine.io-client`_ library, versions 1.5.0 and up.
|
||||
- Compatible with Python 2.7 and Python 3.3+.
|
||||
- Supports large number of clients even on modest hardware when used with an asynchronous server based on `asyncio`_(`sanic`_ or `aiohttp`_), `eventlet`_ or `gevent`_. For development and testing, any WSGI compliant multi-threaded server can be used.
|
||||
- Includes a WSGI middleware that integrates Engine.IO traffic with standard WSGI applications.
|
||||
- Uses an event-based architecture implemented with decorators that hides the details of the protocol.
|
||||
- Implements HTTP long-polling and WebSocket transports.
|
||||
- Supports XHR2 and XHR browsers as clients.
|
||||
- Supports text and binary messages.
|
||||
- Supports gzip and deflate HTTP compression.
|
||||
- Configurable CORS responses to avoid cross-origin problems with browsers.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
The following application uses the Eventlet asynchronous server, and includes a
|
||||
small Flask application that serves the HTML/Javascript to the client:
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
import engineio
|
||||
import eventlet
|
||||
import eventlet.wsgi
|
||||
from flask import Flask, render_template
|
||||
|
||||
eio = engineio.Server()
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
"""Serve the client-side application."""
|
||||
return render_template('index.html')
|
||||
|
||||
@eio.on('connect')
|
||||
def connect(sid, environ):
|
||||
print("connect ", sid)
|
||||
|
||||
@eio.on('message')
|
||||
def message(sid, data):
|
||||
print("message ", data)
|
||||
eio.send(sid, 'reply')
|
||||
|
||||
@eio.on('disconnect')
|
||||
def disconnect(sid):
|
||||
print('disconnect ', sid)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# wrap Flask application with engineio's middleware
|
||||
app = engineio.Middleware(eio, app)
|
||||
|
||||
# deploy as an eventlet WSGI server
|
||||
eventlet.wsgi.server(eventlet.listen(('', 8000)), app)
|
||||
|
||||
|
||||
And below is a similar example, coded for asyncio (Python 3.5+ only) with the
|
||||
`aiohttp`_ framework:
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
from aiohttp import web
|
||||
import engineio
|
||||
|
||||
eio = engineio.AsyncServer()
|
||||
app = web.Application()
|
||||
eio.attach(app)
|
||||
|
||||
async def index(request):
|
||||
"""Serve the client-side application."""
|
||||
with open('index.html') as f:
|
||||
return web.Response(text=f.read(), content_type='text/html')
|
||||
|
||||
@eio.on('connect')
|
||||
def connect(sid, environ):
|
||||
print("connect ", sid)
|
||||
|
||||
@eio.on('message')
|
||||
async def message(sid, data):
|
||||
print("message ", data)
|
||||
await eio.send(sid, 'reply')
|
||||
|
||||
@eio.on('disconnect')
|
||||
def disconnect(sid):
|
||||
print('disconnect ', sid)
|
||||
|
||||
app.router.add_static('/static', 'static')
|
||||
app.router.add_get('/', index)
|
||||
|
||||
if __name__ == '__main__':
|
||||
web.run_app(app)
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
- `Documentation`_
|
||||
- `PyPI`_
|
||||
|
||||
.. _Engine.IO: https://github.com/Automattic/engine.io
|
||||
.. _engine.io-client: https://github.com/Automattic/engine.io-client
|
||||
.. _asyncio: https://docs.python.org/3/library/asyncio.html
|
||||
.. _sanic: http://sanic.readthedocs.io/
|
||||
.. _aiohttp: http://aiohttp.readthedocs.io/
|
||||
.. _eventlet: http://eventlet.net/
|
||||
.. _gevent: http://gevent.org/
|
||||
.. _aiohttp: http://aiohttp.readthedocs.io/
|
||||
.. _Documentation: http://pythonhosted.org/python-engineio
|
||||
.. _PyPI: https://pypi.python.org/pypi/python-engineio
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
engineio/__init__.py,sha256=PxJl0mYvU7fZ1BjI2UP1jGm5ImWv-_DGquoal8E2i3s,374
|
||||
engineio/async_aiohttp.py,sha256=8SnfTW2Q-eQVPcXcOxwFqetqSvasxZRI_2fIsIGYxoA,3588
|
||||
engineio/async_eventlet.py,sha256=VncByIejG9w1Yq5xXvrKWCXeWLMijS0y4Qskr-S-FZ0,1023
|
||||
engineio/async_gevent.py,sha256=A_2cvNtktrVmYNz3KWgGmT52hxTn6uRgP39PeI_F6Tc,1869
|
||||
engineio/async_gevent_uwsgi.py,sha256=RGwq6ar95JDCmEbaKGJEZZmGUofukH6G5UCgwO1vJpU,5469
|
||||
engineio/async_sanic.py,sha256=qnEW9RQyx3xCwmUl_IgA0C7Q-mbiVAorm-uIXKiwqAA,4386
|
||||
engineio/async_threading.py,sha256=RwdgOVRieguNyK25hdxOaaSybIUxROexeBwDmi1KxvE,408
|
||||
engineio/asyncio_server.py,sha256=bnlBlAlzynZ2Kr666m43J0ImtAzeMJig_Dr-Ce2eJPE,13047
|
||||
engineio/asyncio_socket.py,sha256=tJ8FW9eFED43NhHURd9km7iFBjEmSRj03O34PawpQl4,8586
|
||||
engineio/exceptions.py,sha256=OaHvdiV2nzfwLglzzM7jmWE5up6i-HzJZQKYahVh6pQ,190
|
||||
engineio/middleware.py,sha256=A06QDIA95qCZapm2oHV6pWIP3sJkY5QCXg-jXz0jfhE,2223
|
||||
engineio/packet.py,sha256=7rGg2-ctKZrsnlrkQ27D9kysO6vAMYPBfm28YO6j1Hk,3217
|
||||
engineio/payload.py,sha256=o0DfBy9syFyPw-wg46AgYMigfqYfncLKF6udjAacrA4,3897
|
||||
engineio/server.py,sha256=JYbp9UQ4hN5zXF0893ZArJEtU0PuBpbAAiN0H0KAll0,20390
|
||||
engineio/socket.py,sha256=Zx16Q_-OYjsP7khxlTDS8R2X5vhrOTKg99rvSFcwNG0,8842
|
||||
python_engineio-1.7.0.dist-info/DESCRIPTION.rst,sha256=qUF-H_RnG-fa4d55O6nGjJ09SzD9xl4QTND89Cj9Ztc,3558
|
||||
python_engineio-1.7.0.dist-info/METADATA,sha256=Le4cdEb7nhNfixBgqQ5TAbYGvVHCoueUI4_8hIen0ek,4284
|
||||
python_engineio-1.7.0.dist-info/RECORD,,
|
||||
python_engineio-1.7.0.dist-info/WHEEL,sha256=BtVfdXUcEYLcFjOkbIrCFRyXU4qszVPt-E9o3RWkSNw,93
|
||||
python_engineio-1.7.0.dist-info/metadata.json,sha256=R-DMcVXP04A067qWBFoQpUf5WV1-u97Sa4GeOh4u6Bw,962
|
||||
python_engineio-1.7.0.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
|
||||
python_engineio-1.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
engineio/async_threading.pyc,,
|
||||
engineio/__init__.pyc,,
|
||||
engineio/payload.pyc,,
|
||||
engineio/async_eventlet.pyc,,
|
||||
engineio/socket.pyc,,
|
||||
engineio/async_gevent_uwsgi.pyc,,
|
||||
engineio/exceptions.pyc,,
|
||||
engineio/server.pyc,,
|
||||
engineio/packet.pyc,,
|
||||
engineio/async_gevent.pyc,,
|
||||
engineio/middleware.pyc,,
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.29.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: cp27-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"classifiers": ["Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules"], "extensions": {"python.details": {"contacts": [{"email": "miguelgrinberg50@gmail.com", "name": "Miguel Grinberg", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://github.com/miguelgrinberg/python-engineio/"}}}, "extras": [], "generator": "bdist_wheel (0.29.0)", "license": "MIT", "metadata_version": "2.0", "name": "python-engineio", "platform": "any", "run_requires": [{"requires": ["six (>=1.9.0)"]}], "summary": "Engine.IO server", "test_requires": [{"requires": ["eventlet", "mock"]}], "version": "1.7.0"}
|
||||
@@ -0,0 +1 @@
|
||||
engineio
|
||||
Reference in New Issue
Block a user