A Unix-style Python web framework: filesystem routing, flat files, messages and cron, with CGI's simplicity at modern speed.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst Replace multipart parser with stdlib-only implementation eb957a2 9 months, 2 weeks ago History
hello.py · 365 bytes · 10 lines
1"""Simple hello API endpoint - demonstrates basic routing"""
2import json
3from dbbasic_web.responses import json as json_response
4
5
6def handle(request):
7 """Handle /hello and /hello?name=World"""
8 name = request.get("query", {}).get("name", "world")
9 body = json.dumps({"message": f"Hello, {name}!", "path": request["path"]})
10 return json_response(body)