Baguette

Latest version: v0.3.1

Safety actively analyzes 687918 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.3.1

Changelog
- Add json encoders in baguette.json
- Add setters in [Request](https://baguette.readthedocs.io/en/latest/api.html#baguette.Request)
- Add properties in [Responses](https://baguette.readthedocs.io/en/latest/api.html#baguette.Response)
- Update and add docs

Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6

0.3

Changelog
- Add [middleware](https://baguette.readthedocs.io/en/latest/user_guide/middlewares.html) support
- Add [Config](https://baguette.readthedocs.io/en/latest/api.html#baguette.Config) class
- Customizable [JSON encoder](https://baguette.readthedocs.io/en/latest/api.html#baguette.JSONResponse.JSON_ENCODER) for JSON responses
- Update and add docs

Example of how to use middlewares
py
import time
from baguette import Baguette, Middleware

app = Baguette()

app.middleware()
class TimingMiddleware(Middleware):
async def __call__(self, request: Request):
start_time = time.perf_counter()
response = await self.next(request)
print(
"{0.method} {0.path} took {1} seconds to be handled".format(
request, time.perf_counter() - start_time
)
)
return response


Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6

0.3.0

0.2.1

Changelog
- Accept bytes as handler return value
- Add many docs

Example of the new feature
py
from baguette import Baguette

app = Baguette()

app.route("/")
async def index():
return b"<h1>Hello, World!</h1>"


Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6

0.2.0

- Add HTML rendering
- Add redirects

Example code
`main.py`
py
from baguette import Baguette, redirect, render

app = Baguette()

app.route("/")
async def index():
return redirect("/home")

app.route("/home")
async def home(request):
user = ... do some user handling, lets assume user has a name attribute
return render("home.html", username=user.name)


`templates/home.html`:
html
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Hello {{ username }}!</h1>
</body>
</html>


Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6

0.1.6

Fix bug in `await request.form(include_querystring=True)`

Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.