Add Code
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,24 @@
|
||||
Copyright (c) Aymeric Augustin and contributors
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,174 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: websockets
|
||||
Version: 12.0
|
||||
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
|
||||
Author-email: Aymeric Augustin <aymeric.augustin@m4x.org>
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Homepage, https://github.com/python-websockets/websockets
|
||||
Project-URL: Changelog, https://websockets.readthedocs.io/en/stable/project/changelog.html
|
||||
Project-URL: Documentation, https://websockets.readthedocs.io/
|
||||
Project-URL: Funding, https://tidelift.com/subscription/pkg/pypi-websockets?utm_source=pypi-websockets&utm_medium=referral&utm_campaign=readme
|
||||
Project-URL: Tracker, https://github.com/python-websockets/websockets/issues
|
||||
Keywords: WebSocket
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Requires-Python: >=3.8
|
||||
License-File: LICENSE
|
||||
|
||||
.. image:: logo/horizontal.svg
|
||||
:width: 480px
|
||||
:alt: websockets
|
||||
|
||||
|licence| |version| |pyversions| |tests| |docs| |openssf|
|
||||
|
||||
.. |licence| image:: https://img.shields.io/pypi/l/websockets.svg
|
||||
:target: https://pypi.python.org/pypi/websockets
|
||||
|
||||
.. |version| image:: https://img.shields.io/pypi/v/websockets.svg
|
||||
:target: https://pypi.python.org/pypi/websockets
|
||||
|
||||
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/websockets.svg
|
||||
:target: https://pypi.python.org/pypi/websockets
|
||||
|
||||
.. |tests| image:: https://img.shields.io/github/checks-status/python-websockets/websockets/main?label=tests
|
||||
:target: https://github.com/python-websockets/websockets/actions/workflows/tests.yml
|
||||
|
||||
.. |docs| image:: https://img.shields.io/readthedocs/websockets.svg
|
||||
:target: https://websockets.readthedocs.io/
|
||||
|
||||
.. |openssf| image:: https://bestpractices.coreinfrastructure.org/projects/6475/badge
|
||||
:target: https://bestpractices.coreinfrastructure.org/projects/6475
|
||||
|
||||
What is ``websockets``?
|
||||
-----------------------
|
||||
|
||||
websockets is a library for building WebSocket_ servers and clients in Python
|
||||
with a focus on correctness, simplicity, robustness, and performance.
|
||||
|
||||
.. _WebSocket: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
|
||||
|
||||
Built on top of ``asyncio``, Python's standard asynchronous I/O framework, the
|
||||
default implementation provides an elegant coroutine-based API.
|
||||
|
||||
An implementation on top of ``threading`` and a Sans-I/O implementation are also
|
||||
available.
|
||||
|
||||
`Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_
|
||||
|
||||
.. copy-pasted because GitHub doesn't support the include directive
|
||||
|
||||
Here's an echo server with the ``asyncio`` API:
|
||||
|
||||
.. code:: python
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
import asyncio
|
||||
from websockets.server import serve
|
||||
|
||||
async def echo(websocket):
|
||||
async for message in websocket:
|
||||
await websocket.send(message)
|
||||
|
||||
async def main():
|
||||
async with serve(echo, "localhost", 8765):
|
||||
await asyncio.Future() # run forever
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
Here's how a client sends and receives messages with the ``threading`` API:
|
||||
|
||||
.. code:: python
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
from websockets.sync.client import connect
|
||||
|
||||
def hello():
|
||||
with connect("ws://localhost:8765") as websocket:
|
||||
websocket.send("Hello world!")
|
||||
message = websocket.recv()
|
||||
print(f"Received: {message}")
|
||||
|
||||
hello()
|
||||
|
||||
|
||||
Does that look good?
|
||||
|
||||
`Get started with the tutorial! <https://websockets.readthedocs.io/en/stable/intro/index.html>`_
|
||||
|
||||
Why should I use ``websockets``?
|
||||
--------------------------------
|
||||
|
||||
The development of ``websockets`` is shaped by four principles:
|
||||
|
||||
1. **Correctness**: ``websockets`` is heavily tested for compliance with
|
||||
:rfc:`6455`. Continuous integration fails under 100% branch coverage.
|
||||
|
||||
2. **Simplicity**: all you need to understand is ``msg = await ws.recv()`` and
|
||||
``await ws.send(msg)``. ``websockets`` takes care of managing connections
|
||||
so you can focus on your application.
|
||||
|
||||
3. **Robustness**: ``websockets`` is built for production. For example, it was
|
||||
the only library to `handle backpressure correctly`_ before the issue
|
||||
became widely known in the Python community.
|
||||
|
||||
4. **Performance**: memory usage is optimized and configurable. A C extension
|
||||
accelerates expensive operations. It's pre-compiled for Linux, macOS and
|
||||
Windows and packaged in the wheel format for each system and Python version.
|
||||
|
||||
Documentation is a first class concern in the project. Head over to `Read the
|
||||
Docs`_ and see for yourself.
|
||||
|
||||
.. _Read the Docs: https://websockets.readthedocs.io/
|
||||
.. _handle backpressure correctly: https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#websocket-servers
|
||||
|
||||
Why shouldn't I use ``websockets``?
|
||||
-----------------------------------
|
||||
|
||||
* If you prefer callbacks over coroutines: ``websockets`` was created to
|
||||
provide the best coroutine-based API to manage WebSocket connections in
|
||||
Python. Pick another library for a callback-based API.
|
||||
|
||||
* If you're looking for a mixed HTTP / WebSocket library: ``websockets`` aims
|
||||
at being an excellent implementation of :rfc:`6455`: The WebSocket Protocol
|
||||
and :rfc:`7692`: Compression Extensions for WebSocket. Its support for HTTP
|
||||
is minimal — just enough for an HTTP health check.
|
||||
|
||||
If you want to do both in the same server, look at HTTP frameworks that
|
||||
build on top of ``websockets`` to support WebSocket connections, like
|
||||
Sanic_.
|
||||
|
||||
.. _Sanic: https://sanicframework.org/en/
|
||||
|
||||
What else?
|
||||
----------
|
||||
|
||||
Bug reports, patches and suggestions are welcome!
|
||||
|
||||
To report a security vulnerability, please use the `Tidelift security
|
||||
contact`_. Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
.. _Tidelift security contact: https://tidelift.com/security
|
||||
|
||||
For anything else, please open an issue_ or send a `pull request`_.
|
||||
|
||||
.. _issue: https://github.com/python-websockets/websockets/issues/new
|
||||
.. _pull request: https://github.com/python-websockets/websockets/compare/
|
||||
|
||||
Participants must uphold the `Contributor Covenant code of conduct`_.
|
||||
|
||||
.. _Contributor Covenant code of conduct: https://github.com/python-websockets/websockets/blob/main/CODE_OF_CONDUCT.md
|
||||
|
||||
``websockets`` is released under the `BSD license`_.
|
||||
|
||||
.. _BSD license: https://github.com/python-websockets/websockets/blob/main/LICENSE
|
||||
@@ -0,0 +1,85 @@
|
||||
websockets-12.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
websockets-12.0.dist-info/LICENSE,sha256=PWoMBQ2L7FL6utUC5F-yW9ArytvXDeo01Ee2oP9Obag,1514
|
||||
websockets-12.0.dist-info/METADATA,sha256=AxtN_yngdOy_wohEsaZLR4wyOo2SrG0R3a4ASgFWk0U,6612
|
||||
websockets-12.0.dist-info/RECORD,,
|
||||
websockets-12.0.dist-info/WHEEL,sha256=G6lFmoMhSbs0Q-00Az13cTGLqHuRAod_vXdfPOceLY0,225
|
||||
websockets-12.0.dist-info/top_level.txt,sha256=CMpdKklxKsvZgCgyltxUWOHibZXZ1uYIVpca9xsQ8Hk,11
|
||||
websockets/__init__.py,sha256=Y4tu2IwlZ71xBCVGRaovGDBVdKH9dabTFyHMF3g-DgE,5658
|
||||
websockets/__main__.py,sha256=8Dtga-XePHQ4jqgMMuXHT8XRH_hSvs8bEZ7-v49vTKg,4744
|
||||
websockets/__pycache__/__init__.cpython-312.pyc,,
|
||||
websockets/__pycache__/__main__.cpython-312.pyc,,
|
||||
websockets/__pycache__/auth.cpython-312.pyc,,
|
||||
websockets/__pycache__/client.cpython-312.pyc,,
|
||||
websockets/__pycache__/connection.cpython-312.pyc,,
|
||||
websockets/__pycache__/datastructures.cpython-312.pyc,,
|
||||
websockets/__pycache__/exceptions.cpython-312.pyc,,
|
||||
websockets/__pycache__/frames.cpython-312.pyc,,
|
||||
websockets/__pycache__/headers.cpython-312.pyc,,
|
||||
websockets/__pycache__/http.cpython-312.pyc,,
|
||||
websockets/__pycache__/http11.cpython-312.pyc,,
|
||||
websockets/__pycache__/imports.cpython-312.pyc,,
|
||||
websockets/__pycache__/protocol.cpython-312.pyc,,
|
||||
websockets/__pycache__/server.cpython-312.pyc,,
|
||||
websockets/__pycache__/streams.cpython-312.pyc,,
|
||||
websockets/__pycache__/typing.cpython-312.pyc,,
|
||||
websockets/__pycache__/uri.cpython-312.pyc,,
|
||||
websockets/__pycache__/utils.cpython-312.pyc,,
|
||||
websockets/__pycache__/version.cpython-312.pyc,,
|
||||
websockets/auth.py,sha256=pCeunT3V2AdwRt_Tpq9TrkdGY7qUlDHIEqeggj5yQFk,262
|
||||
websockets/client.py,sha256=lIa508JN6xCQdzX3xfL3D6x8LpWyhct29Z64ScX1muQ,12562
|
||||
websockets/connection.py,sha256=UivBmLaKmEOGpL1bU8uwh1PXIqMFiOUTVRi_gM7w5Rg,333
|
||||
websockets/datastructures.py,sha256=6OgolFXa_rj9OOEtRnO2rXXzEB2A8aTd9GaTL1Yp66Q,5582
|
||||
websockets/exceptions.py,sha256=DYWg9XEZ47WmWWC26117rfF5zes6zpBs-N4rZXkcn50,10296
|
||||
websockets/extensions/__init__.py,sha256=QkZsxaJVllVSp1uhdD5uPGibdbx_091GrVVfS5LXcpw,98
|
||||
websockets/extensions/__pycache__/__init__.cpython-312.pyc,,
|
||||
websockets/extensions/__pycache__/base.cpython-312.pyc,,
|
||||
websockets/extensions/__pycache__/permessage_deflate.cpython-312.pyc,,
|
||||
websockets/extensions/base.py,sha256=5shEU7lqmsLC7-y3OCWih1VdS_wOImmZwuAaEKl9kDU,3271
|
||||
websockets/extensions/permessage_deflate.py,sha256=bPFOAyTUDU7IIJyCGnWfr5yZF_J8dhCwJWt7jWuYM6c,24782
|
||||
websockets/frames.py,sha256=wEmgahW6XwtGucEH4y7S93NWR3elfBvcQSNT3mzPOQw,13700
|
||||
websockets/headers.py,sha256=RYryH2zqB_2Y02BTF2KsQFfYxAM6-Kh-A3Dv_32opAA,16120
|
||||
websockets/http.py,sha256=T-c3LhgQHcdjKj2AJPzEJ6y_XK8tARDy_XjtmWqO8CM,897
|
||||
websockets/http11.py,sha256=QcZ7u-UYbO98xQXrUz43qgaBXk-AyoQBHJBR0J9qYRE,12565
|
||||
websockets/imports.py,sha256=SXXs0glid-UHcwla5yjR72DIbGeUTrS9VFagPvPvRNY,2790
|
||||
websockets/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
websockets/legacy/__pycache__/__init__.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/async_timeout.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/auth.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/client.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/compatibility.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/framing.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/handshake.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/http.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/protocol.cpython-312.pyc,,
|
||||
websockets/legacy/__pycache__/server.cpython-312.pyc,,
|
||||
websockets/legacy/async_timeout.py,sha256=nHW_nJYnxtuprwPduZMTl789KAymwmv0ukLbzm2Z8yU,8540
|
||||
websockets/legacy/auth.py,sha256=WP68nZ1KAS0YCfNRyYG2M6LrNmT6xa430YnAjoeAP3g,6287
|
||||
websockets/legacy/client.py,sha256=-tProFDSLOxIGhjo44klpFUKsrpYCpe6NJrk2qDzd-0,26123
|
||||
websockets/legacy/compatibility.py,sha256=zgisuAUM4D5zKnyocY4JoNxhKjslodjOjGxu0QCbX1I,260
|
||||
websockets/legacy/framing.py,sha256=M4J6ZPRK-zNqY_UgPQ4Qppc4R64aSMftO7FR_0VpG-Q,4998
|
||||
websockets/legacy/handshake.py,sha256=RggPKl-w8oFJZQYZR0IdIOTrsz040pYp0Gu4L_D7_4U,5479
|
||||
websockets/legacy/http.py,sha256=qmrM7pa0kuuJIroMVahBAH8_ZVqkD91YhwVux_xpfeI,6938
|
||||
websockets/legacy/protocol.py,sha256=5H5uKIF7DbFgVCrwMd330GUH0ZWonihoi6QP27EN0Ww,63343
|
||||
websockets/legacy/server.py,sha256=DwapgRDPgcCeZrC-2a1BxoNModWC0xbEk6ESLNcpReI,44737
|
||||
websockets/protocol.py,sha256=bs5OH2UKrF1t7BQCpzU1DCzCJAHVNyLRzfnh8tcdbS0,24002
|
||||
websockets/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
websockets/server.py,sha256=hJB3yl-QO2LLhPhyo_ahAI_dhJoxy9AB6S9vsyrpzuY,21136
|
||||
websockets/speedups.c,sha256=ghPq-NF35VLVNkMv0uFDIruNpVISyW-qvoZgPpE65qw,5834
|
||||
websockets/speedups.cpython-312-x86_64-linux-gnu.so,sha256=mvPFUvZ0wYSc7gsl8KsH-KdqPg7mc5sQk5zCHtvs69A,36144
|
||||
websockets/streams.py,sha256=8nv62HYyS74t_JSWGie4SoYAz8-jMcQacaHnD0RkK90,4038
|
||||
websockets/sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
websockets/sync/__pycache__/__init__.cpython-312.pyc,,
|
||||
websockets/sync/__pycache__/client.cpython-312.pyc,,
|
||||
websockets/sync/__pycache__/connection.cpython-312.pyc,,
|
||||
websockets/sync/__pycache__/messages.cpython-312.pyc,,
|
||||
websockets/sync/__pycache__/server.cpython-312.pyc,,
|
||||
websockets/sync/__pycache__/utils.cpython-312.pyc,,
|
||||
websockets/sync/client.py,sha256=-9we3AHtE25pcT6EHGQ0oIyGzfYs18AzLpyDn4RLi94,11265
|
||||
websockets/sync/connection.py,sha256=XBdZgDyZKyW3Bm_N5hhiT8uQvtj9lrB0qDVA4BP5wfA,29578
|
||||
websockets/sync/messages.py,sha256=pTcWhwD-uwA0l4a26_xgPHgP8pjRYk5xrX5Vhq-JuCo,9484
|
||||
websockets/sync/server.py,sha256=081Gzsneal-pFTvo5d7iPljUlQjV05ZNp4yVM57tfw0,18674
|
||||
websockets/sync/utils.py,sha256=yUDxjeM4yVeXOZ_Go4ajgTUDOy-0rEWkjcR_RZDqcYY,1151
|
||||
websockets/typing.py,sha256=naXTu4ToUF2k43XZhbW9Tt519yt876hVw66CjxQihII,1527
|
||||
websockets/uri.py,sha256=oymYUo7bX8LofYzXpT3UqTZfkCt2y4s680Xr-qw88qk,3215
|
||||
websockets/utils.py,sha256=QBhgbXn9ZvvLEzj-X8-zSHWVMkUqc6Wm-_HBjga5RNM,1150
|
||||
websockets/version.py,sha256=XFPgNJrcyqeM0MPa7rBzmzplATL8PdK3-pv6hHkyBAw,2747
|
||||
@@ -0,0 +1,8 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.41.2)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp312-cp312-manylinux_2_5_x86_64
|
||||
Tag: cp312-cp312-manylinux1_x86_64
|
||||
Tag: cp312-cp312-manylinux_2_17_x86_64
|
||||
Tag: cp312-cp312-manylinux2014_x86_64
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
websockets
|
||||
Reference in New Issue
Block a user