scalar-fastapi 1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.1
2
+ Name: scalar_fastapi
3
+ Version: 1.0
4
+ Summary: This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with FastAPI.
5
+ Home-page: https://github.com/scalar/scalar
6
+ Author: Marc Laventure
7
+ Author-email: marc@scalar.com
8
+ Description-Content-Type: text/markdown
File without changes
File without changes
@@ -0,0 +1,79 @@
1
+ from typing_extensions import Annotated, Doc
2
+ from fastapi.responses import HTMLResponse
3
+
4
+ def get_scalar_api_reference(
5
+ *,
6
+ openapi_url: Annotated[
7
+ str,
8
+ Doc(
9
+ """
10
+ The OpenAPI URL that Scalar should load and use.
11
+ This is normally done automatically by FastAPI using the default URL
12
+ `/openapi.json`.
13
+ """
14
+ ),
15
+ ],
16
+ title: Annotated[
17
+ str,
18
+ Doc(
19
+ """
20
+ The HTML `<title>` content, normally shown in the browser tab.
21
+ """
22
+ ),
23
+ ],
24
+ scalar_js_url: Annotated[
25
+ str,
26
+ Doc(
27
+ """
28
+ The URL to use to load the Scalar JavaScript.
29
+ It is normally set to a CDN URL.
30
+ """
31
+ ),
32
+ ] = "https://cdn.jsdelivr.net/npm/@scalar/api-reference",
33
+ scalar_proxy_url: Annotated[
34
+ str,
35
+ Doc(
36
+ """
37
+ The URL to use to set the Scalar Proxy.
38
+ It is normally set to a Scalar API URL (https://api.scalar.com/request-proxy), but default is empty
39
+ """
40
+ ),
41
+ ] = "",
42
+ scalar_favicon_url: Annotated[
43
+ str,
44
+ Doc(
45
+ """
46
+ The URL of the favicon to use. It is normally shown in the browser tab.
47
+ """
48
+ ),
49
+ ] = "https://fastapi.tiangolo.com/img/favicon.png",
50
+ ) -> HTMLResponse:
51
+ html = f"""
52
+ <!DOCTYPE html>
53
+ <html>
54
+ <head>
55
+ <title>{title}</title>
56
+ <!-- needed for adaptive design -->
57
+ <meta charset="utf-8"/>
58
+ <meta name="viewport" content="width=device-width, initial-scale=1">
59
+ <link rel="shortcut icon" href="{scalar_favicon_url}">
60
+ <style>
61
+ body {{
62
+ margin: 0;
63
+ padding: 0;
64
+ }}
65
+ </style>
66
+ </head>
67
+ <body>
68
+ <noscript>
69
+ Scalar requires Javascript to function. Please enable it to browse the documentation.
70
+ </noscript>
71
+ <script
72
+ id="api-reference"
73
+ data-url="{openapi_url}"
74
+ data-proxy-url="{scalar_proxy_url}"></script>
75
+ <script src="{scalar_js_url}"></script>
76
+ </body>
77
+ </html>
78
+ """
79
+ return HTMLResponse(html)
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.1
2
+ Name: scalar-fastapi
3
+ Version: 1.0
4
+ Summary: This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with FastAPI.
5
+ Home-page: https://github.com/scalar/scalar
6
+ Author: Marc Laventure
7
+ Author-email: marc@scalar.com
8
+ Description-Content-Type: text/markdown
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.cfg
3
+ setup.py
4
+ scalar_fastapi/__init__.py
5
+ scalar_fastapi/scalar_fastapi.py
6
+ scalar_fastapi.egg-info/PKG-INFO
7
+ scalar_fastapi.egg-info/SOURCES.txt
8
+ scalar_fastapi.egg-info/dependency_links.txt
9
+ scalar_fastapi.egg-info/top_level.txt
10
+ tests/__init__.py
@@ -0,0 +1,2 @@
1
+ scalar_fastapi
2
+ tests
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,18 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='scalar_fastapi',
5
+ version='1.0',
6
+ packages=find_packages(),
7
+ install_requires=[
8
+ # Add your package dependencies here
9
+ ],
10
+ author='Marc Laventure',
11
+ author_email='marc@scalar.com',
12
+ description='This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with FastAPI.',
13
+ long_description=open('README.md').read(),
14
+ long_description_content_type='text/markdown',
15
+ url='https://github.com/scalar/scalar',
16
+ # classifiers=[
17
+ # ],
18
+ )
File without changes