Twig 0.5.0
Twig is a backend web framework for python utilizing the socket module to handle http requests and serve responses.
To install use the following command:
py -m pip install TwigWeb
Changelog
0.5.0
-
Fixed dynamic router.
-
Implemented URL query parameters.
-
Implemented Headers class to separate parts of incoming request for the developer.
0.4.0
-
Added dynamic route parameters.
-
Improved route handling with Route class
0.3.0
-
Added static paths and folders functions.
-
Added element class.
-
Added component classes.
0.2.0
-
Added
set_all_routesfunction -
Fixed inconsistent request handling
-
Improved documentation
Example
This example does not show all of the functionality of Twig. There is documentation currently being worked on.
from src.TwigWeb.backend.routehandler.route import Route, RouteParameter, RouteParamType
from src.TwigWeb.backend import Server
from src.TwigWeb.backend.response import Response
app = Server("", debug=True, open_root=False)
@app.route("")
def index(headers):
#this is the index of the app
return Response("test", ContentType.html)
@app.route("form")
def form(headers):
#this form redirects to page/2
return Response("""<form action="/page/2">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>""")
@app.route("page/[num]")
def index(headers, num):
# Headers.URL is a dictionary containing all url query parameters/variables.
# num a dynamic route.
return Response(f"num: {num} and {headers.URL}", ContentType.html)
@app.route("page")
def index(headers):
return Response(f"page", ContentType.html)
app.run()
Metadata
Release files for TwigWeb 0.5.1
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 |
|---|---|---|---|---|
| TwigWeb-0.5.1.tar.gz | 8.5 kB | Without provenance | Details for TwigWeb-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| TwigWeb-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for TwigWeb-0.5.1-py3-none-any.whl |
Total release size: 19.1 kB
Release files / TwigWeb-0.5.1.tar.gz
| Download URL | TwigWeb-0.5.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc123275edc97bff95c5a33371f138f11960f09afcc50b4d01d9fd3d6a465d6b
|
|
BLAKE2b-256 checksum How to use checksums |
6ad211366e281833461c47a012b8521bc4896420141faa4deacca85da4d89e78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.16 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
|
Release files / TwigWeb-0.5.1-py3-none-any.whl
| Download URL | TwigWeb-0.5.1-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a3ae59e775f259472219dbd6fe0f3e7ac6ae139fee26fb21d94a9cf49812d86
|
|
BLAKE2b-256 checksum How to use checksums |
2af8a29a35f78d1799b7c26563d5cf868d332249c941efde13e62e73c8475b21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.16 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
|
Security for TwigWeb 0.5.1
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.