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.responses import HTMLResponse
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.responses import HTMLResponse
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.11.9.tar.gz
(634.7 kB
view details)
Built Distribution
stopments-24.11.9-py3-none-any.whl
(634.9 kB
view details)
File details
Details for the file stopments-24.11.9.tar.gz
.
File metadata
- Download URL: stopments-24.11.9.tar.gz
- Upload date:
- Size: 634.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 099573242b983f0e8f1c5983570db3dc56171924f74b2f5d9a5c510a5d1fdbc3 |
|
MD5 | 1c3a87121c19f46d55034b0527a52615 |
|
BLAKE2b-256 | 74cf1965cfd3125409043fd4b503274895ee626aa8894e36d5a38d680b7eec6b |
File details
Details for the file stopments-24.11.9-py3-none-any.whl
.
File metadata
- Download URL: stopments-24.11.9-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.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f832fbbf886fddd64ebb648bb7258a5ed8fcd9e0190f292e49b350243c9375f |
|
MD5 | 7000327f3f7c2d6b8f13f04edd6c15c1 |
|
BLAKE2b-256 | 0b7fc69fe8933f62d1374ab63582bcdf99e06357e56e7a7e9ce99cf8d84eafdc |