Stoplight elements html
Project description
Stopments
Stoplight elements static files
Refered from FastAPI's #5168 PR
It includes the following files:
styles.min.css
web-components.min.js
favicon.ico
The static files were collected on the same date as this package version.
Installation
pip install stopments
Usage
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from stopments import get_stoplight_elements_html
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs/", include_in_schema=False)
async def docs():
html = get_stoplight_elements_html(
openapi_url=app.openapi_url or "/openapi.json",
title="API Documentation",
)
return HTMLResponse(content=html)
or you can use embedded static files
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from stopments import get_stoplight_elements_html
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(packages=[("stopments", "static")]))
@app.get("/docs/", include_in_schema=False)
async def docs():
html = get_stoplight_elements_html(
openapi_url=app.openapi_url or "/openapi.json",
title="API Documentation",
stoplight_elements_css_url="/static/styles.min.css",
stoplight_elements_js_url="/static/web-components.min.js",
stoplight_elements_favicon_url="/static/favicon.ico",
)
return HTMLResponse(content=html)
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stopments-24.10.29.tar.gz
(634.6 kB
view details)
Built Distribution
stopments-24.10.29-py3-none-any.whl
(634.9 kB
view details)
File details
Details for the file stopments-24.10.29.tar.gz
.
File metadata
- Download URL: stopments-24.10.29.tar.gz
- Upload date:
- Size: 634.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9321c87e4ef2e4c93c0b6b2f9eb382a9eb44ff592cc90a753323bdb39d7fb30 |
|
MD5 | d6d19bf0f6a8ac89d98981f4640c8457 |
|
BLAKE2b-256 | 8f34d11ffecb79cdc1a6d4bce4a9b316d7d7ecd5bc5938ff246c8c4f1ef083d4 |
File details
Details for the file stopments-24.10.29-py3-none-any.whl
.
File metadata
- Download URL: stopments-24.10.29-py3-none-any.whl
- Upload date:
- Size: 634.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f54885dc88a7661a99b900259fe4865c1eb5c42643f1a03937bec1c0c05854b9 |
|
MD5 | 2cf817d5bc1a1080b0ce8f28e529ca7f |
|
BLAKE2b-256 | ef3d073da42d386a0023e0c74021069248d33351e0628ebdd5aa4827cbc20723 |