Add fastapi code
This commit is contained in:
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,174 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: starlette
|
||||
Version: 0.21.0
|
||||
Summary: The little ASGI library that shines.
|
||||
Project-URL: Homepage, https://github.com/encode/starlette
|
||||
Author-email: Tom Christie <tom@tomchristie.com>
|
||||
License-File: LICENSE.md
|
||||
Classifier: Development Status :: 3 - Alpha
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: AnyIO
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
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
|
||||
Classifier: Topic :: Internet :: WWW/HTTP
|
||||
Requires-Python: >=3.7
|
||||
Requires-Dist: anyio<5,>=3.4.0
|
||||
Requires-Dist: typing-extensions>=3.10.0; python_version < '3.10'
|
||||
Provides-Extra: full
|
||||
Requires-Dist: httpx>=0.22.0; extra == 'full'
|
||||
Requires-Dist: itsdangerous; extra == 'full'
|
||||
Requires-Dist: jinja2; extra == 'full'
|
||||
Requires-Dist: python-multipart; extra == 'full'
|
||||
Requires-Dist: pyyaml; extra == 'full'
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.starlette.io/"><img width="420px" src="https://raw.githubusercontent.com/encode/starlette/master/docs/img/starlette.png" alt='starlette'></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<em>✨ The little ASGI framework that shines. ✨</em>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/encode/starlette/actions">
|
||||
<img src="https://github.com/encode/starlette/workflows/Test%20Suite/badge.svg" alt="Build Status">
|
||||
</a>
|
||||
<a href="https://pypi.org/project/starlette/">
|
||||
<img src="https://badge.fury.io/py/starlette.svg" alt="Package version">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
**Documentation**: [https://www.starlette.io/](https://www.starlette.io/)
|
||||
|
||||
---
|
||||
|
||||
# Starlette
|
||||
|
||||
Starlette is a lightweight [ASGI][asgi] framework/toolkit,
|
||||
which is ideal for building async web services in Python.
|
||||
|
||||
It is production-ready, and gives you the following:
|
||||
|
||||
* A lightweight, low-complexity HTTP web framework.
|
||||
* WebSocket support.
|
||||
* In-process background tasks.
|
||||
* Startup and shutdown events.
|
||||
* Test client built on `httpx`.
|
||||
* CORS, GZip, Static Files, Streaming responses.
|
||||
* Session and Cookie support.
|
||||
* 100% test coverage.
|
||||
* 100% type annotated codebase.
|
||||
* Few hard dependencies.
|
||||
* Compatible with `asyncio` and `trio` backends.
|
||||
* Great overall performance [against independent benchmarks][techempower].
|
||||
|
||||
## Requirements
|
||||
|
||||
Python 3.7+ (For Python 3.6 support, install version 0.19.1)
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
$ pip3 install starlette
|
||||
```
|
||||
|
||||
You'll also want to install an ASGI server, such as [uvicorn](http://www.uvicorn.org/), [daphne](https://github.com/django/daphne/), or [hypercorn](https://pgjones.gitlab.io/hypercorn/).
|
||||
|
||||
```shell
|
||||
$ pip3 install uvicorn
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
**example.py**:
|
||||
|
||||
```python
|
||||
from starlette.applications import Starlette
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.routing import Route
|
||||
|
||||
|
||||
async def homepage(request):
|
||||
return JSONResponse({'hello': 'world'})
|
||||
|
||||
routes = [
|
||||
Route("/", endpoint=homepage)
|
||||
]
|
||||
|
||||
app = Starlette(debug=True, routes=routes)
|
||||
```
|
||||
|
||||
Then run the application using Uvicorn:
|
||||
|
||||
```shell
|
||||
$ uvicorn example:app
|
||||
```
|
||||
|
||||
For a more complete example, see [encode/starlette-example](https://github.com/encode/starlette-example).
|
||||
|
||||
## Dependencies
|
||||
|
||||
Starlette only requires `anyio`, and the following are optional:
|
||||
|
||||
* [`httpx`][httpx] - Required if you want to use the `TestClient`.
|
||||
* [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`.
|
||||
* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
|
||||
* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
|
||||
* [`pyyaml`][pyyaml] - Required for `SchemaGenerator` support.
|
||||
|
||||
You can install all of these with `pip3 install starlette[full]`.
|
||||
|
||||
## Framework or Toolkit
|
||||
|
||||
Starlette is designed to be used either as a complete framework, or as
|
||||
an ASGI toolkit. You can use any of its components independently.
|
||||
|
||||
```python
|
||||
from starlette.responses import PlainTextResponse
|
||||
|
||||
|
||||
async def app(scope, receive, send):
|
||||
assert scope['type'] == 'http'
|
||||
response = PlainTextResponse('Hello, world!')
|
||||
await response(scope, receive, send)
|
||||
```
|
||||
|
||||
Run the `app` application in `example.py`:
|
||||
|
||||
```shell
|
||||
$ uvicorn example:app
|
||||
INFO: Started server process [11509]
|
||||
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
||||
```
|
||||
|
||||
Run uvicorn with `--reload` to enable auto-reloading on code changes.
|
||||
|
||||
## Modularity
|
||||
|
||||
The modularity that Starlette is designed on promotes building re-usable
|
||||
components that can be shared between any ASGI framework. This should enable
|
||||
an ecosystem of shared middleware and mountable applications.
|
||||
|
||||
The clean API separation also means it's easier to understand each component
|
||||
in isolation.
|
||||
|
||||
---
|
||||
|
||||
<p align="center"><i>Starlette is <a href="https://github.com/encode/starlette/blob/master/LICENSE.md">BSD licensed</a> code.<br/>Designed & crafted with care.</i></br>— ⭐️ —</p>
|
||||
|
||||
[asgi]: https://asgi.readthedocs.io/en/latest/
|
||||
[httpx]: https://www.python-httpx.org/
|
||||
[jinja2]: http://jinja.pocoo.org/
|
||||
[python-multipart]: https://andrew-d.github.io/python-multipart/
|
||||
[itsdangerous]: https://pythonhosted.org/itsdangerous/
|
||||
[sqlalchemy]: https://www.sqlalchemy.org
|
||||
[pyyaml]: https://pyyaml.org/wiki/PyYAMLDocumentation
|
||||
[techempower]: https://www.techempower.com/benchmarks/#hw=ph&test=fortune&l=zijzen-sf
|
||||
@ -0,0 +1,74 @@
|
||||
starlette-0.21.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
starlette-0.21.0.dist-info/METADATA,sha256=xtZcB5CYHaNBFT43ppjJ3uwDJruGAetJRCttjfl95tg,5560
|
||||
starlette-0.21.0.dist-info/RECORD,,
|
||||
starlette-0.21.0.dist-info/WHEEL,sha256=TC-eT-WEjZM-lmd6au7o3p1ewVkC6Y0NftwooPaNZTY,87
|
||||
starlette-0.21.0.dist-info/licenses/LICENSE.md,sha256=3LlWd6AiQCQxh-lk-UGEfRmxeCHPmeWvrmhPqzKMGb8,1518
|
||||
starlette/__init__.py,sha256=-reNiXr25nUU7em7_IKJzimCI10W4nA8ouxAiOr4FaQ,23
|
||||
starlette/__pycache__/__init__.cpython-311.pyc,,
|
||||
starlette/__pycache__/_compat.cpython-311.pyc,,
|
||||
starlette/__pycache__/_utils.cpython-311.pyc,,
|
||||
starlette/__pycache__/applications.cpython-311.pyc,,
|
||||
starlette/__pycache__/authentication.cpython-311.pyc,,
|
||||
starlette/__pycache__/background.cpython-311.pyc,,
|
||||
starlette/__pycache__/concurrency.cpython-311.pyc,,
|
||||
starlette/__pycache__/config.cpython-311.pyc,,
|
||||
starlette/__pycache__/convertors.cpython-311.pyc,,
|
||||
starlette/__pycache__/datastructures.cpython-311.pyc,,
|
||||
starlette/__pycache__/endpoints.cpython-311.pyc,,
|
||||
starlette/__pycache__/exceptions.cpython-311.pyc,,
|
||||
starlette/__pycache__/formparsers.cpython-311.pyc,,
|
||||
starlette/__pycache__/requests.cpython-311.pyc,,
|
||||
starlette/__pycache__/responses.cpython-311.pyc,,
|
||||
starlette/__pycache__/routing.cpython-311.pyc,,
|
||||
starlette/__pycache__/schemas.cpython-311.pyc,,
|
||||
starlette/__pycache__/staticfiles.cpython-311.pyc,,
|
||||
starlette/__pycache__/status.cpython-311.pyc,,
|
||||
starlette/__pycache__/templating.cpython-311.pyc,,
|
||||
starlette/__pycache__/testclient.cpython-311.pyc,,
|
||||
starlette/__pycache__/types.cpython-311.pyc,,
|
||||
starlette/__pycache__/websockets.cpython-311.pyc,,
|
||||
starlette/_compat.py,sha256=yqCApnDFpPoAiMrEF5CnOiTngAb6_pPTR2ykPtxWCb4,1149
|
||||
starlette/_utils.py,sha256=6lZyElcEOpxiR2CNg4Zyfs0QlppIxqS9Ls46wjQRTW0,289
|
||||
starlette/applications.py,sha256=xo5gDNBWO3Dfld1fUxVa0Qm14oyvMAXH6huDTiXXSzU,9936
|
||||
starlette/authentication.py,sha256=D75AvQ1h0lieiDiuCnomd4Jgu-SIq-79LUjkaKMsydI,5246
|
||||
starlette/background.py,sha256=g0ouyGnoI2CdtE2N_AJiOYUf1ChyLJcaqFqU8gIlAFo,1259
|
||||
starlette/concurrency.py,sha256=IIxlJASchhv7T1ik_WQRuN-6Pd0r--_x4gqt9odO0Yc,1741
|
||||
starlette/config.py,sha256=JCfSW49qj6ZwbNgIBZQym7zb0fXr1hzzUaANaenrecY,4504
|
||||
starlette/convertors.py,sha256=G5OFkuGVGkaoJDLrrrMjqbmFtsvybzJ0VpLsC-0xH5I,2166
|
||||
starlette/datastructures.py,sha256=lJH9seB7a2mkFfqyRuWcurzudF6owu-W6cJSz2RXpJM,22646
|
||||
starlette/endpoints.py,sha256=LcX8AXiyIhuJJjZC7EBNbKQhFMrTnF0P0M13cIg4Mlk,5145
|
||||
starlette/exceptions.py,sha256=1m1T-7xlfk1WWWfmQg0VdehYOemsCNh0Igxq43euoek,1648
|
||||
starlette/formparsers.py,sha256=VlsUjHKRw_CHKTq-pNoRc10z6CyMG6ZnpQYTFtPNWV8,9241
|
||||
starlette/middleware/__init__.py,sha256=tEegvh1lBhUfHaJ0p-T_9FU7PRT1WHoIc2vZX0pUlm8,546
|
||||
starlette/middleware/__pycache__/__init__.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/authentication.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/base.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/cors.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/errors.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/exceptions.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/gzip.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/httpsredirect.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/sessions.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/trustedhost.cpython-311.pyc,,
|
||||
starlette/middleware/__pycache__/wsgi.cpython-311.pyc,,
|
||||
starlette/middleware/authentication.py,sha256=rP3t8t7HoO3xW8LH48Yo_GY8jzyx7WCrT88m_1O_kJ4,1787
|
||||
starlette/middleware/base.py,sha256=4u2HWj_Y9GI3LlmIEPpBxiro7zaqViIoJyRY_hQlK6I,4125
|
||||
starlette/middleware/cors.py,sha256=x_pPPhDxTKZq4Zue3dMjzvSI580e_QZG6xqP9OgJ4iM,7076
|
||||
starlette/middleware/errors.py,sha256=5eqOu5oaJTnmIiomBrUk1iTGRunQrTmQ34KGQIb3y5o,7793
|
||||
starlette/middleware/exceptions.py,sha256=lNklm6eq3CRN2_Y6fLUNYe9gAZ7CfUkc8l6-U9Dyow4,4128
|
||||
starlette/middleware/gzip.py,sha256=GJlMYl-GHhkDIPIRchvbat3Fi-DRMITt8zHN6pq2OlQ,4087
|
||||
starlette/middleware/httpsredirect.py,sha256=SNTleaYALGoITV7xwbic4gB6VYdM8Ylea_ykciUz31g,848
|
||||
starlette/middleware/sessions.py,sha256=-F3j-pXq1cNmvVh1qxrn4pnVHJwxzOCWC90vd7y8apo,3612
|
||||
starlette/middleware/trustedhost.py,sha256=5oTnnGRXQC4KJTROs802G9tJzBij2zI9ze11aEdbins,2207
|
||||
starlette/middleware/wsgi.py,sha256=YbjlcETXYzaN5--Rk2uC2vEvxAiKwuvWQ7IuOFjU3H4,4906
|
||||
starlette/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
starlette/requests.py,sha256=vekodqrCLji29_gcjliq_wPByBUpMCY-NJNz7qCpHYk,9982
|
||||
starlette/responses.py,sha256=39MsClDBqwd55BpsYf1qhhnexmK9KuWDhxnxvW3ugy8,12910
|
||||
starlette/routing.py,sha256=UHz7YYGvLV4JKQ9TYYbwEZJqNIQOGlEME3XczIG3T-M,31616
|
||||
starlette/schemas.py,sha256=ZAD8C5e5Y_0lHagl6Y8hlcaYO5uzjTZWTd-6IbUPgy4,4940
|
||||
starlette/staticfiles.py,sha256=vJM-osz1YCAtml40WIdq96pJv3TLpFL5Xa6-le4DLUA,8499
|
||||
starlette/status.py,sha256=lv40V7igYhk_ONySJzUzQ4T3gTgnvNLCOb846ZUONSE,6086
|
||||
starlette/templating.py,sha256=dwKMdegSRx-r3MUnDWHiXmz2GI_3sC02EATBJinyqbk,3620
|
||||
starlette/testclient.py,sha256=EVloVxCyaC4Lr1ZHeSN8mrl52xBp9G-YpbtMMcfYJLs,27326
|
||||
starlette/types.py,sha256=RbisZ8DEsquztH1HwK6_8Iy5ZvQwddYcDDFW32KEN3o,302
|
||||
starlette/websockets.py,sha256=dCDRvGsp62FXrxDv320P7fv5QggUK21kneokFq9juWQ,7317
|
||||
@ -0,0 +1,4 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: hatchling 1.10.0
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
@ -0,0 +1,27 @@
|
||||
Copyright © 2018, [Encode OSS Ltd](https://www.encode.io/).
|
||||
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 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.
|
||||
Reference in New Issue
Block a user