The tools that power the canopy.
Project description
understory
the tools that power the canopy
web
tools for metamodern web development
>>> import web
Browser
uses Firefox via Selenium
>>> browser = web.browser()
>>> browser.go("en.wikipedia.org/wiki/Pasta")
>>> browser.shot("wikipedia-pasta.png")
Cache
uses SQLite
>>> cache = web.cache()
>>> cache["indieweb.org/note"].entry["summary"]
"A note is a post that is typically short unstructured* plain text, written & posted quickly, that has its own permalink page."
>>> cache["indieweb.org/note"].entry["summary"] # served from cache
"A note is a post that is typically short unstructured* plain text, written & posted quickly, that has its own permalink page."
Application
WSGI-compatible
In hello.py
:
import web
app = web.application("HelloWorld")
@app.route(r"")
class HelloWorld:
def _get(self):
return "Hello World!"
In setup.py
:
...
setup(install_requires=["web"],
entry_points={"web.apps": ["hello:app"]},
...)
Templating
Full Python inside string templates.
>>> web.template("$def with (name)\n$name")("Alice")
"Alice"
Markdown
Strict syntax subset (there should be one and only one way).
Picoformat support eg. @person, @@org, #tag, %license
>>> str(web.mkdn("*lorem* ipsum."))
"<p><em>lorem</em> ipsum. </p>"
URL parsing
Defaults to safe-mode and raises DangerousURL eagerly. Up-to-date public suffix and HSTS support.
>>> url = web.uri("example.cnpy.gdn/foo/bar?id=38")
>>> url.host
"example.cnpy.gdn"
>>> url.suffix
"cnpy.gdn"
>>> url.is_hsts()
True
IndieWeb
Supported: IndieAuth client/server, Micropub client/server, Microsub :construction:, WebSub :construction:, Webmention :construction:
>>> app.mount(web.indieauth.server)
>>> app.mount(web.micropub.server)
Microformats
Parse mf2
from HTML. Analyze vocabularies for stability/interoperability.
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
understory-0.0.1a101.tar.gz
(226.7 kB
view hashes)
Built Distribution
understory-0.0.1a101-py3-none-any.whl
(248.0 kB
view hashes)
Close
Hashes for understory-0.0.1a101-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15390bf378be23db1936ca4bead0fc5ab593ae527cb8bce87699bf26d9a0d170 |
|
MD5 | cd85364c07fb260497a8d1d78c7518c0 |
|
BLAKE2b-256 | 0c49234a56fea1a8e267559a3c4d9a75933662b3a46f5447e8106ef943f930be |