python-fasthtml 0.9.1__tar.gz → 0.9.2__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.9.1/python_fasthtml.egg-info → python-fasthtml-0.9.2}/PKG-INFO +1 -1
- python-fasthtml-0.9.2/fasthtml/__init__.py +2 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/_modidx.py +3 -3
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/core.py +1 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/oauth.py +15 -15
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2/python_fasthtml.egg-info}/PKG-INFO +1 -1
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/settings.ini +1 -1
- python-fasthtml-0.9.1/fasthtml/__init__.py +0 -2
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/CONTRIBUTING.md +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/LICENSE +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/MANIFEST.in +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/README.md +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/authmw.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/basics.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/cli.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/common.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/components.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/components.pyi +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/core.pyi +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/fastapp.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/ft.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/js.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/jupyter.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/katex.js +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/live_reload.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/pico.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/starlette.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/svg.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/toaster.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/xtend.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/fasthtml/xtend.pyi +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/pyproject.toml +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/not-zip-safe +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/requires.txt +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/setup.cfg +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/setup.py +0 -0
- {python-fasthtml-0.9.1 → python-fasthtml-0.9.2}/tests/test_toaster.py +0 -0
|
@@ -149,11 +149,11 @@ d = { 'settings': { 'branch': 'main',
|
|
|
149
149
|
'fasthtml/oauth.py'),
|
|
150
150
|
'fasthtml.oauth.OAuth': ('api/oauth.html#oauth', 'fasthtml/oauth.py'),
|
|
151
151
|
'fasthtml.oauth.OAuth.__init__': ('api/oauth.html#oauth.__init__', 'fasthtml/oauth.py'),
|
|
152
|
-
'fasthtml.oauth.OAuth.
|
|
153
|
-
'fasthtml.oauth.OAuth.
|
|
154
|
-
'fasthtml.oauth.OAuth.login': ('api/oauth.html#oauth.login', 'fasthtml/oauth.py'),
|
|
152
|
+
'fasthtml.oauth.OAuth.check_invalid': ('api/oauth.html#oauth.check_invalid', 'fasthtml/oauth.py'),
|
|
153
|
+
'fasthtml.oauth.OAuth.get_auth': ('api/oauth.html#oauth.get_auth', 'fasthtml/oauth.py'),
|
|
155
154
|
'fasthtml.oauth.OAuth.login_link': ('api/oauth.html#oauth.login_link', 'fasthtml/oauth.py'),
|
|
156
155
|
'fasthtml.oauth.OAuth.logout': ('api/oauth.html#oauth.logout', 'fasthtml/oauth.py'),
|
|
156
|
+
'fasthtml.oauth.OAuth.redir_login': ('api/oauth.html#oauth.redir_login', 'fasthtml/oauth.py'),
|
|
157
157
|
'fasthtml.oauth.OAuth.redir_url': ('api/oauth.html#oauth.redir_url', 'fasthtml/oauth.py'),
|
|
158
158
|
'fasthtml.oauth.WebApplicationClient.login_link': ( 'api/oauth.html#webapplicationclient.login_link',
|
|
159
159
|
'fasthtml/oauth.py'),
|
|
@@ -239,6 +239,7 @@ def _find_wsp(ws, data, hdrs, arg:str, p:Parameter):
|
|
|
239
239
|
if arg.lower()=='htmx': return _get_htmx(hdrs)
|
|
240
240
|
if arg.lower()=='app': return ws.scope['app']
|
|
241
241
|
if arg.lower()=='send': return partial(_send_ws, ws)
|
|
242
|
+
if 'session'.startswith(arg.lower()): return ws.scope.get('session', {})
|
|
242
243
|
return None
|
|
243
244
|
res = data.get(arg, None)
|
|
244
245
|
if res is empty or res is None: res = hdrs.get(arg, None)
|
|
@@ -143,10 +143,9 @@ class OAuth:
|
|
|
143
143
|
store_attr()
|
|
144
144
|
def before(req, session):
|
|
145
145
|
auth = req.scope['auth'] = session.get('auth')
|
|
146
|
-
if not auth: return
|
|
147
|
-
|
|
148
|
-
if
|
|
149
|
-
|
|
146
|
+
if not auth: return self.redir_login(session)
|
|
147
|
+
res = self.check_invalid(req, session, auth)
|
|
148
|
+
if res: return res
|
|
150
149
|
app.before.append(Beforeware(before, skip=skip))
|
|
151
150
|
|
|
152
151
|
@app.get(redir_path)
|
|
@@ -155,23 +154,24 @@ class OAuth:
|
|
|
155
154
|
scheme = 'http' if url_match(req.url,self.http_patterns) or not self.https else 'https'
|
|
156
155
|
base_url = f"{scheme}://{req.url.netloc}"
|
|
157
156
|
info = AttrDictDefault(cli.retr_info(code, base_url+redir_path))
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
ident = info.get(self.cli.id_key)
|
|
158
|
+
if not ident: return self.redir_login(session)
|
|
159
|
+
res = self.get_auth(info, ident, session, state)
|
|
160
|
+
if not res: return self.redir_login(session)
|
|
161
|
+
req.scope['auth'] = session['auth'] = ident
|
|
162
|
+
return res
|
|
161
163
|
|
|
162
164
|
@app.get(logout_path)
|
|
163
165
|
def logout(session):
|
|
164
166
|
session.pop('auth', None)
|
|
165
167
|
return self.logout(session)
|
|
166
168
|
|
|
167
|
-
def
|
|
169
|
+
def redir_login(self, session): return RedirectResponse(self.login_path, status_code=303)
|
|
170
|
+
def redir_url(self, req):
|
|
168
171
|
scheme = 'http' if url_match(req.url,self.http_patterns) or not self.https else 'https'
|
|
169
172
|
return redir_url(req, self.redir_path, scheme)
|
|
170
|
-
def login_link(self, req, scope=None, state=None): return self.cli.login_link(self.redir_url(req), scope=scope, state=state)
|
|
171
173
|
|
|
172
|
-
def
|
|
173
|
-
def
|
|
174
|
-
def
|
|
175
|
-
def
|
|
176
|
-
ident = info.get(self.cli.id_key)
|
|
177
|
-
return ident and self.chk_auth(info, ident, session)
|
|
174
|
+
def login_link(self, req, scope=None, state=None): return self.cli.login_link(self.redir_url(req), scope=scope, state=state)
|
|
175
|
+
def check_invalid(self, req, session, auth): return False
|
|
176
|
+
def logout(self, session): return self.redir_login(session)
|
|
177
|
+
def get_auth(self, info, ident, session, state): raise NotImplementedError()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[DEFAULT]
|
|
2
2
|
repo = fasthtml
|
|
3
3
|
lib_name = fasthtml
|
|
4
|
-
version = 0.9.
|
|
4
|
+
version = 0.9.2
|
|
5
5
|
min_python = 3.10
|
|
6
6
|
license = apache2
|
|
7
7
|
requirements = fastcore>=1.7.18 python-dateutil starlette>0.33 oauthlib itsdangerous uvicorn[standard]>=0.30 httpx fastlite>=0.0.9 python-multipart beautifulsoup4
|
|
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.9.1 → python-fasthtml-0.9.2}/python_fasthtml.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|