Wieder was gelernt

Python Web Framework Cheat Sheet

2022-11-01 (Tuesday) — 2025-04-25 (Friday)
Tags: Flask FastAPI Django Web Python Programming Reference

Feature Flask FastAPI Django Variable rules in routes <type:variable> [R] Return HTTP error abort(code) [R] Statt dem Code kann man auch ein Response-Objekt angeben, z.B. abort( make_response( jsonify(message="Post not found"), 404 ) ) raise HTTPException(status_code=, detail=, headers=) [R] return HttpResponse(status_code=404) . For some status codes there are also predefined subclasses, so for 404, we can use return HttpResponseNotFound() or even raise Http404()

She Who Must Be Obeyed

2025-01-12 (Sunday) — 2025-01-12 (Sunday)
Tags: phrase

First(?) used in 1887 by H. Rider Haggard in his novel “She: A History of Adventure”. Probably popularized by the 1970’s TV series “Rumpole of the Bailey” by John Mortimer. (S: Roger Bell_West, Lieven Marchand)

Prnting the web

2024-12-26 (Thursday) — 2024-12-26 (Thursday)
Tags: html printing css

Printing the web, part 1: retrieving content from the web Printing the web, part 2: HTML and CSS for printing books Prince: Tool to convert HTML to PDF which supports all the cool CSS features for printing. It’s quite expensive, but there are reasonably priced cloud resellers.

Counting unique visitors without using cookies, UIDs or fingerprinting

2024-12-26 (Thursday) — 2024-12-26 (Thursday)
Tags: privacy web analytics

Counting unique visitors without using cookies, UIDs or fingerprinting TLDR: Abuse last-modified header as a counter. While this technically doesn’t use cookies, I don’t see any advantage from a privacy perspective to a simple cookie-based counter. Quite the opposite, actually: It reeks of subterfuge.

Divvi Up

2024-12-26 (Thursday) — 2024-12-26 (Thursday)
Tags: telemetry privacy

Divvi Up: privacy-respecting telemetry aggregation Divvi Up: A privacy respecting telemetry service

Unison

2024-12-16 (Monday) — 2024-12-16 (Monday)
Tags: programming language cloud non-textual programming language lwn

Programming in Unison, by Daroc Alden, LWN, June 25, 2024 Homepage

Cryptographers' Feedback on the EU Digital Identity's ARF

2024-12-16 (Monday) — 2024-12-16 (Monday)
Tags: EU Privacy Authentication EUDIW eiDAS anonymous credentials

Cryptographers’ Feedback on the EU Digital Identity’s ARF

BeeWare Tutorial

2024-12-16 (Monday) — 2024-12-16 (Monday)
Tags: packaging desktop mobile SPA

Welcome to the BeeWare Tutorial! In this tutorial, we’re going to build a graphical user interface using Python, and deploy it as a desktop application, as a mobile application, and as a single page web app. We’ll also look at how you can use BeeWare tools to perform some of the common tasks that you’ll need to do as an app developer, such as testing your app.

buildozer

2024-12-16 (Monday) — 2024-12-16 (Monday)
Tags: Python packaging Android iOS Windows OSX Linux

buildozer Buildozer is a tool for creating application packages easily. The goal is to have one “buildozer.spec” file in your app directory, describing your application requirements and settings such as title, icon, included modules etc. Buildozer will use that spec to create a package for Android, iOS, Windows, OSX and/or Linux.

Function Decorators in Python

2024-12-15 (Sunday) — 2024-12-15 (Sunday)
Tags: Python

The description of function decorators in the language reference is quite dense, so I’m teasing it apart here with two examples from 5 Custom Python Decorators For Your Projects by NeuralNine. Decorator without parameters def time_logger(func): def wrapper(*args, **kwargs): start = time.perf_counter() result = func(*args, **kwargs) end = time.perf_counter() print("Time taken:", end - start) return result return wrapper @time_logger def process_input(n): # whatever Decorator expressions are evaluated when the function is defined, in the scope that contains the function definition.