Add fastapi code

This commit is contained in:
2022-11-27 13:16:21 +01:00
parent 7cc1a424dc
commit 337ca690cf
2880 changed files with 643628 additions and 0 deletions

View File

@ -0,0 +1,25 @@
Copyright (c) 2013-2021 Aymeric Augustin and contributors.
All rights reserved.
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 websockets 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.

View File

@ -0,0 +1,172 @@
Metadata-Version: 2.1
Name: websockets
Version: 10.4
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Home-page: https://github.com/aaugustin/websockets
Author: Aymeric Augustin
Author-email: aymeric.augustin@m4x.org
License: BSD
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/aaugustin/websockets/issues
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.7
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.7
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/aaugustin/websockets/main?label=tests
:target: https://github.com/aaugustin/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, it
provides an elegant coroutine-based API.
`Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_
Here's how a client sends and receives messages:
.. copy-pasted because GitHub doesn't support the include directive
.. code:: python
#!/usr/bin/env python
import asyncio
from websockets import connect
async def hello(uri):
async with connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.run(hello("ws://localhost:8765"))
And here's an echo server:
.. code:: python
#!/usr/bin/env python
import asyncio
from websockets 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())
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 a 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/aaugustin/websockets/issues/new
.. _pull request: https://github.com/aaugustin/websockets/compare/
Participants must uphold the `Contributor Covenant code of conduct`_.
.. _Contributor Covenant code of conduct: https://github.com/aaugustin/websockets/blob/main/CODE_OF_CONDUCT.md
``websockets`` is released under the `BSD license`_.
.. _BSD license: https://github.com/aaugustin/websockets/blob/main/LICENSE

View File

@ -0,0 +1,69 @@
websockets-10.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
websockets-10.4.dist-info/LICENSE,sha256=2uyhG_NgjaNeVG6gwyvhiViovhRB-j3py9IOTIvHGOY,1536
websockets-10.4.dist-info/METADATA,sha256=hVYjRF1j51DgmYXCTxF9_YJzzpH8GEDvwXEe-2uLxuE,6390
websockets-10.4.dist-info/RECORD,,
websockets-10.4.dist-info/WHEEL,sha256=lVPXYH8LMHYHuLy0p0zNneWNEw-dpoJ5k5Tb3b38QMM,225
websockets-10.4.dist-info/top_level.txt,sha256=AmmQQqhFwjoCEKzNajXY5f28yxLP_cgVflJES82E_cs,51
websockets/__init__.py,sha256=bUXfO7WIhkYVe5PYiEMKqe2WUhb8UHX9kg0aKI7IiR4,3436
websockets/__main__.py,sha256=q35Sx_FtGpvypZe9bhMQE9-Gn7SycFIJs-rZplO2Ai4,7255
websockets/__pycache__/__init__.cpython-311.pyc,,
websockets/__pycache__/__main__.cpython-311.pyc,,
websockets/__pycache__/auth.cpython-311.pyc,,
websockets/__pycache__/client.cpython-311.pyc,,
websockets/__pycache__/connection.cpython-311.pyc,,
websockets/__pycache__/datastructures.cpython-311.pyc,,
websockets/__pycache__/exceptions.cpython-311.pyc,,
websockets/__pycache__/frames.cpython-311.pyc,,
websockets/__pycache__/headers.cpython-311.pyc,,
websockets/__pycache__/http.cpython-311.pyc,,
websockets/__pycache__/http11.cpython-311.pyc,,
websockets/__pycache__/imports.cpython-311.pyc,,
websockets/__pycache__/server.cpython-311.pyc,,
websockets/__pycache__/streams.cpython-311.pyc,,
websockets/__pycache__/typing.cpython-311.pyc,,
websockets/__pycache__/uri.cpython-311.pyc,,
websockets/__pycache__/utils.cpython-311.pyc,,
websockets/__pycache__/version.cpython-311.pyc,,
websockets/auth.py,sha256=5XuTnxp6f2jzaNvTKhtOZ-OmM2gpTk7VQf6cy4yt60A,147
websockets/client.py,sha256=UZyMsjVd4qNE6WXwlEhK4PlEJrlDouG1ZNfM_q5TuD8,11885
websockets/connection.py,sha256=-idouSlNUOSAMcvVpZTxLehKpsS7_2_YL7_pWEQl3OI,23665
websockets/datastructures.py,sha256=pcT7RdCI6ZfYddHWMcwPR-1A89GRpj26xgdtmZsRgiA,5738
websockets/exceptions.py,sha256=Fxb5U01EEyS4I39OC1eFZ435Mzpp39g4di9XH-kMvBo,10049
websockets/extensions/__init__.py,sha256=QkZsxaJVllVSp1uhdD5uPGibdbx_091GrVVfS5LXcpw,98
websockets/extensions/__pycache__/__init__.cpython-311.pyc,,
websockets/extensions/__pycache__/base.cpython-311.pyc,,
websockets/extensions/__pycache__/permessage_deflate.cpython-311.pyc,,
websockets/extensions/base.py,sha256=pD-rkuMKayftnwJ2dT3w_GgmEi7jI30dsICBFj1Qj2s,3101
websockets/extensions/permessage_deflate.py,sha256=AeOA-tTty6i-VHpGF5UcGsKx7bhy0jDDiiwVtM4u8Ns,24783
websockets/frames.py,sha256=17GdqK_JMtz4jjyQ2PVeF3pUbesRWEIRvexln9iNueg,12532
websockets/headers.py,sha256=RYryH2zqB_2Y02BTF2KsQFfYxAM6-Kh-A3Dv_32opAA,16120
websockets/http.py,sha256=HR_IIij3xpoKkiLzGp4h5_NkVr2a8ZeCqGUopo6U4Rs,644
websockets/http11.py,sha256=KY0KyOncYn_VQNMJ0IS_cqZj8-ACv5UWzm-KNHf3HMw,12569
websockets/imports.py,sha256=SXXs0glid-UHcwla5yjR72DIbGeUTrS9VFagPvPvRNY,2790
websockets/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
websockets/legacy/__pycache__/__init__.cpython-311.pyc,,
websockets/legacy/__pycache__/auth.cpython-311.pyc,,
websockets/legacy/__pycache__/client.cpython-311.pyc,,
websockets/legacy/__pycache__/compatibility.cpython-311.pyc,,
websockets/legacy/__pycache__/framing.cpython-311.pyc,,
websockets/legacy/__pycache__/handshake.cpython-311.pyc,,
websockets/legacy/__pycache__/http.cpython-311.pyc,,
websockets/legacy/__pycache__/protocol.cpython-311.pyc,,
websockets/legacy/__pycache__/server.cpython-311.pyc,,
websockets/legacy/auth.py,sha256=1Vz32WAia2JNnQt1dYVkIg3sErcH68jnaK4U-ypIH_Q,6477
websockets/legacy/client.py,sha256=5H9ZCI59geB-dSEgBrJarV15ogJTYXl9f9B70twL_G4,26486
websockets/legacy/compatibility.py,sha256=fWvZfzx13bBU2eOUIJrZCJJS8N3fSyZjO5RD1tYn0K0,314
websockets/legacy/framing.py,sha256=-sQ75uMx_sWU6jd3VTZgCHxviWcWkKr3JyCnB1HWvkk,5002
websockets/legacy/handshake.py,sha256=RK_ui9O5TLQrb-eBKcX_5s8Xc7BOlLjC_gNFvui4wi4,5476
websockets/legacy/http.py,sha256=d4e8ie780NsYqKvQltW1kAXdy4eE5Kcr8jQp8DT5VFs,6930
websockets/legacy/protocol.py,sha256=wi9fbgsd-aEdZv3yXaB-VGGoxlGA7D3aH8jZOiPd1CY,63015
websockets/legacy/server.py,sha256=wtaoQczSFvScfpV9ypq_aEMvd11ZZBKunqAp6-v1HS4,44288
websockets/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
websockets/server.py,sha256=pqXhsO1IeoKvYFEL8xkrBqab6Ec3xBUP8g_11XConKc,18480
websockets/speedups.c,sha256=ghPq-NF35VLVNkMv0uFDIruNpVISyW-qvoZgPpE65qw,5834
websockets/speedups.cpython-311-x86_64-linux-gnu.so,sha256=HEOSRcbWzsXtQC96WoLePrHv-Fk9fZyt6cTcR097jQQ,35488
websockets/streams.py,sha256=8nv62HYyS74t_JSWGie4SoYAz8-jMcQacaHnD0RkK90,4038
websockets/typing.py,sha256=yx0SxSmil5JfG4fUtj-dgyR1UcW5wwmvgqtEOmcJxm4,1384
websockets/uri.py,sha256=oymYUo7bX8LofYzXpT3UqTZfkCt2y4s680Xr-qw88qk,3215
websockets/utils.py,sha256=QBhgbXn9ZvvLEzj-X8-zSHWVMkUqc6Wm-_HBjga5RNM,1150
websockets/version.py,sha256=7FBg8cYekYczE5jF8cZj0nixf-alfH2wpDH0AqrFhcQ,2721

View File

@ -0,0 +1,8 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.37.1)
Root-Is-Purelib: false
Tag: cp311-cp311-manylinux_2_5_x86_64
Tag: cp311-cp311-manylinux1_x86_64
Tag: cp311-cp311-manylinux_2_17_x86_64
Tag: cp311-cp311-manylinux2014_x86_64

View File

@ -0,0 +1,3 @@
websockets
websockets/extensions
websockets/legacy