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.1a103.tar.gz
(226.8 kB
view hashes)
Built Distribution
understory-0.0.1a103-py3-none-any.whl
(248.0 kB
view hashes)
Close
Hashes for understory-0.0.1a103-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44817baffd3db706cbca946f8fddacdf8dd1c8c5ee96374e7d5d0dfa8f2a9c86 |
|
MD5 | 8520d51afd62c3836a194112e3a9a9a6 |
|
BLAKE2b-256 | 7eea88e65344387d5677a113bbc001cace180954f1748495a325f828bd2c7b72 |