python-fasthtml 0.12.42__tar.gz → 0.12.43__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.
- {python_fasthtml-0.12.42/python_fasthtml.egg-info → python_fasthtml-0.12.43}/PKG-INFO +1 -1
- python_fasthtml-0.12.43/fasthtml/__init__.py +2 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/_modidx.py +4 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/core.py +13 -5
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43/python_fasthtml.egg-info}/PKG-INFO +1 -1
- python_fasthtml-0.12.42/fasthtml/__init__.py +0 -2
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/CONTRIBUTING.md +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/LICENSE +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/MANIFEST.in +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/README.md +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/authmw.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/basics.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/cli.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/common.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/components.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/components.pyi +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/core.pyi +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/fastapp.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/ft.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/js.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/jupyter.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/katex.js +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/live_reload.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/oauth.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/pico.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/starlette.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/stripe_otp.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/svg.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/toaster.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/xtend.py +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/fasthtml/xtend.pyi +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/pyproject.toml +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/requires.txt +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/setup.cfg +0 -0
- {python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/tests/test_toaster.py +0 -0
|
@@ -33,6 +33,10 @@ d = { 'settings': { 'branch': 'main',
|
|
|
33
33
|
'fasthtml.core.APIRouter._wrap_func': ('api/core.html#apirouter._wrap_func', 'fasthtml/core.py'),
|
|
34
34
|
'fasthtml.core.APIRouter.to_app': ('api/core.html#apirouter.to_app', 'fasthtml/core.py'),
|
|
35
35
|
'fasthtml.core.APIRouter.ws': ('api/core.html#apirouter.ws', 'fasthtml/core.py'),
|
|
36
|
+
'fasthtml.core.ApiReturn': ('api/core.html#apireturn', 'fasthtml/core.py'),
|
|
37
|
+
'fasthtml.core.ApiReturn.__call__': ('api/core.html#apireturn.__call__', 'fasthtml/core.py'),
|
|
38
|
+
'fasthtml.core.ApiReturn.__from_request__': ('api/core.html#apireturn.__from_request__', 'fasthtml/core.py'),
|
|
39
|
+
'fasthtml.core.ApiReturn.__init__': ('api/core.html#apireturn.__init__', 'fasthtml/core.py'),
|
|
36
40
|
'fasthtml.core.Beforeware': ('api/core.html#beforeware', 'fasthtml/core.py'),
|
|
37
41
|
'fasthtml.core.Beforeware.__init__': ('api/core.html#beforeware.__init__', 'fasthtml/core.py'),
|
|
38
42
|
'fasthtml.core.Client': ('api/core.html#client', 'fasthtml/core.py'),
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# %% auto #0
|
|
6
6
|
__all__ = ['empty', 'htmx_hdrs', 'fh_cfg', 'htmx_resps', 'htmx_exts', 'htmxsrc', 'fhjsscr', 'surrsrc', 'scopesrc', 'viewport',
|
|
7
7
|
'charset', 'cors_allow', 'iframe_scr', 'all_meths', 'devtools_loc', 'parsed_date', 'snake2hyphens',
|
|
8
|
-
'HtmxHeaders', 'HttpHeader', 'HtmxResponseHeaders', 'form2dict', 'parse_form', '
|
|
9
|
-
'Beforeware', 'EventStream', 'signal_shutdown', 'uri', 'decode_uri', 'flat_tuple', 'noop_body',
|
|
10
|
-
'is_full_page', 'Redirect', 'get_key', 'qp', 'def_hdrs', 'FastHTML', 'nested_name', 'serve',
|
|
11
|
-
'RouteFuncs', 'APIRouter', 'cookie', 'reg_re_param', 'StaticNoCache', 'MiddlewareBase',
|
|
12
|
-
'unqid']
|
|
8
|
+
'HtmxHeaders', 'HttpHeader', 'HtmxResponseHeaders', 'form2dict', 'parse_form', 'ApiReturn', 'JSONResponse',
|
|
9
|
+
'flat_xt', 'Beforeware', 'EventStream', 'signal_shutdown', 'uri', 'decode_uri', 'flat_tuple', 'noop_body',
|
|
10
|
+
'respond', 'is_full_page', 'Redirect', 'get_key', 'qp', 'def_hdrs', 'FastHTML', 'nested_name', 'serve',
|
|
11
|
+
'Client', 'RouteFuncs', 'APIRouter', 'cookie', 'reg_re_param', 'StaticNoCache', 'MiddlewareBase',
|
|
12
|
+
'FtResponse', 'unqid']
|
|
13
13
|
|
|
14
14
|
# %% ../nbs/api/00_core.ipynb #23503b9e
|
|
15
15
|
import json,uuid,inspect,types,signal,asyncio,threading,inspect,random,contextlib,httpx,itsdangerous,uvicorn
|
|
@@ -166,6 +166,13 @@ async def _from_body(req, p):
|
|
|
166
166
|
cargs = {k: _form_arg(k, v, d) for k, v in data.items() if not d or k in d}
|
|
167
167
|
return anno(**cargs)
|
|
168
168
|
|
|
169
|
+
# %% ../nbs/api/00_core.ipynb #88b6da3f
|
|
170
|
+
class ApiReturn:
|
|
171
|
+
@classmethod
|
|
172
|
+
async def __from_request__(cls, data, req): return cls(req.headers.get('accept')=='application/json')
|
|
173
|
+
def __init__(self, isapi=False): self.isapi = isapi
|
|
174
|
+
def __call__(self, norm, **kw): return kw if self.isapi else norm
|
|
175
|
+
|
|
169
176
|
# %% ../nbs/api/00_core.ipynb #7cc39ba9
|
|
170
177
|
class JSONResponse(JSONResponseOrig):
|
|
171
178
|
"Same as starlette's version, but auto-stringifies non serializable types"
|
|
@@ -196,6 +203,7 @@ async def _find_p(req, arg:str, p:Parameter):
|
|
|
196
203
|
if arg.lower()=='app': return req.scope['app']
|
|
197
204
|
if arg.lower()=='body': return (await req.body()).decode()
|
|
198
205
|
if arg.lower()=='state': return req.scope['app'].state
|
|
206
|
+
if arg.lower()=='api': return ApiReturn(req.headers.get('accept')=='application/json')
|
|
199
207
|
if arg.lower() in ('hdrs','ftrs','bodykw','htmlkw'): return getattr(req, arg.lower())
|
|
200
208
|
if arg!='resp': warn(f"`{arg} has no type annotation and is not a recognised special name, so is ignored.")
|
|
201
209
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_fasthtml-0.12.42 → python_fasthtml-0.12.43}/python_fasthtml.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|