Flask URL Patterns
Usage
You must instanciate UrlPatterns and provide the urlpatterns param to it as well as a Flask app instance either in __init__ or init_app params.
urlpatterns must be of type: Iterable[URLPattern] with:
class URLPattern(TypedDict):
path: str | Iterable[str]
name: NotRequired[str]
view: NotRequired[RouteCallable]
children: NotRequired[Iterable[URLPattern]]
options: NotRequired[dict[str, Any]]
parent_vars_rename: NotRequired[dict[str, str]]
(In case typing is not up to date in README.md, know that you can see current accepted typing in flask_url_patterns.typing)
Example
from flask import Flask
from flask_url_patterns import URLPatterns
from . import views
app = Flask(__name__)
urlpatterns = UrlPatterns(urlpatterns=[
{
"path": "/",
"name": "index",
"view": views.index,
"children": [
{
"path": "/api",
"name": "api",
"children": [
{
"path": "/resources",
"view": views.ResourceViewSet.as_view({ # Using as implemented by [Flask-ViewSets](https://pypi.org/project/Flask-Viewsets/)
"get": "list",
"post": "create",
}),
"children": [
{
"path": "/<int:id>",
"view": views.ResourceViewSet.as_view({
"get": "retrieve",
"put": "update",
"patch": "partial_update",
"delete": "destroy",
}),
},
],
},
]
},
],
},
])
urlpatterns.init_app(app)
Metadata
Release files for Flask-Url-Patterns 0.1.3
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 |
|---|---|---|---|---|
| flask_url_patterns-0.1.3.tar.gz | 2.9 kB | Without provenance | Details for flask_url_patterns-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_url_patterns-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for flask_url_patterns-0.1.3-py3-none-any.whl |
Total release size: 7.0 kB
Release files / flask_url_patterns-0.1.3.tar.gz
| Download URL | flask_url_patterns-0.1.3.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4873d2acf266d1123c476ea3602c058b394b22a2a758272dff251887af6d5814
|
|
BLAKE2b-256 checksum How to use checksums |
8bc55f39d86c6e145d5d527814aef4fa5cfcbf7ba5917233efbebd2cbc24d5db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2
|
Release files / flask_url_patterns-0.1.3-py3-none-any.whl
| Download URL | flask_url_patterns-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d071f528edcb8b0f082a50dc968a530cc301dff0293fe1985a0ac67b78ed65bc
|
|
BLAKE2b-256 checksum How to use checksums |
71da965f224a933495f5ce79bf9623127fc3edc08ec7632cd880b4c114c7d547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2
|
Security for Flask-Url-Patterns 0.1.3
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.