woshi
On-the-go HTML Abstraction and Generator for Python.
Woshi is simple, it abstracts XML nesting and leverages CSS3 selectors to append elements into the HTML document!
Version 2.0 is a breaking upgrade, which means the general usage and the internal algorithms were change to make it more flexible and lighter. The package lxml was removed in favor of a custom-made builder function. Only simple CSS3 selectors are supported, but will add support in the upcoming versions.
Here's a sample syntax:
page["tag#id"] = "tag #id.class property='10' > inner text"
And scroll down below for more examples.
Official Release
Current version is 2.0, but more updates are coming soon. Compatible with Python 3.10 or later.
pip install woshi
Usage
Import Package
from woshi import Woshi
Initialization
page = Woshi()
# initializing with a valid HTML text
page = Woshi("<div></div>")
# setting up filename
page = Woshi(filepath="home.html")
Creating elements with an inner text
page["head"] = "title > Woshi v1.0"
Creating other elements Basically, you set the parent selector to append the new element.
# create container box
page["body"] = "div #content"
page["#content"] = "div #box.container.light"
# create the popup text
page["#box"] = "div #title.header > Woshi"
page["#box"] = "div .message data-default='Lorem ipsum...' > Hello, world!"
# populate the action buttons
page["#box"] = "div #action.btn-list"
page["#action"] = "button #btn1.btn.btn-no style='background-color:#b22222;color:#fff;' > CLOSE"
page["#action"] = "button #btn2.btn.btn-maybe > LATER"
Setting Properties
page["html"] = "lang=en"
page["body"] = "#canvas"
Yield all matches
for match in page["button"]:
print(match)
Save to HTML file
page.save()
page.save("newFile.html")
Metadata
Release files for woshi 2.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| woshi-2.1.4.tar.gz | 10.8 kB | Without provenance | Details for woshi-2.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| woshi-2.1.4-py3-none-any.whl | Python 3 | none | any | Details for woshi-2.1.4-py3-none-any.whl |
Total release size: 21.5 kB
Release files / woshi-2.1.4.tar.gz
| Download URL | woshi-2.1.4.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5146958732ff932889970d8c1938b5a5d223ed8a91de6d8c58632c8b1294757
|
|
BLAKE2b-256 checksum How to use checksums |
58ed1c59c5a9130b6d5c9ffc9a125203f931e472460ad9554215d68e2cfcf9d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / woshi-2.1.4-py3-none-any.whl
| Download URL | woshi-2.1.4-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00f01976b570f6b30ffa5ce23a724967fb3203a26308afdee5b4fb8345f99135
|
|
BLAKE2b-256 checksum How to use checksums |
cba394a41f82b357f81ef5ab7f9326d913df4133faf127180d5dd23a71777d9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for woshi 2.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.