A timestamp without a zone is a guess
Scraped dates arrive as "2026-03-08 02:30" with nothing else. Some of those times never happened, some happened twice, and the gap between two cities moves during the year.
A scraper reads a time off a page: 2026-03-08 02:30. No zone, no offset. Whatever the schema says, what you have is a guess about when that was.
Times that never happened#
In the United States the clocks went forward on Sunday 2026-03-08, at 02:00 local time, straight to 03:00. So 02:30 that day in New York does not exist. A library has to pick something, and Python's zoneinfo picks the offset from before the jump.
from datetime import datetime
from zoneinfo import ZoneInfo
ny, utc = ZoneInfo("America/New_York"), ZoneInfo("UTC")
t = datetime(2026, 3, 8, 2, 30, tzinfo=ny)
print(t.astimezone(utc)) # 2026-03-08 07:30:00+00:00
print(t.astimezone(utc).astimezone(ny)) # 2026-03-08 03:30:00-04:00, not 02:30It does not raise. Converting it to UTC and back gives you a different local time. A silent change is the dangerous kind.
Times that happened twice#
The clocks go back on Sunday 2026-11-01, so in New York 01:30 happens twice, an hour apart. Python lets you say which with fold.
first = datetime(2026, 11, 1, 1, 30, tzinfo=ny, fold=0)
second = datetime(2026, 11, 1, 1, 30, tzinfo=ny, fold=1)
print(first.astimezone(utc)) # 2026-11-01 05:30:00+00:00
print(second.astimezone(utc)) # 2026-11-01 06:30:00+00:00Same text on the page, one hour apart in UTC. Without a zone on the page, nothing tells you which one you were looking at.
The gap between two cities is not constant#
Europe and the United States change their clocks on different Sundays. In 2026 the US changed on 8 March and Europe on 29 March, and the autumn changes are on 25 October for Europe and 1 November for the US. In between, New York and Berlin are five hours apart instead of six: about three weeks in spring and one week in autumn.
"The US is six hours behind Germany" is true for most of the year and false for a month of it. A meeting scheduled on the rule gets four weeks a year wrong, every year.
What to store#
- UTC. An ISO 8601 string with an offset or a
Z:2026-03-08T07:30:00Z. - The original string, exactly as printed. When the conversion is later found to be wrong, you can redo it.
- The zone, by its IANA name, like
America/New_York. Not the abbreviation:CSTmeans Central Standard Time in North America, China Standard Time and Cuba Standard Time. - Not an offset on its own.
+02:00is Berlin in summer and Johannesburg all year. An offset says how far from UTC, not where, so it cannot tell you what the clock does next month. - How you knew the zone. From the page's own markup, from the site's country, or assumed. Those three are not equally trustworthy, and the field should say which.
When the zone is only assumed, say so in the data. An assumed zone that looks like a known one will go wrong on exactly one Sunday a year and nobody will remember why.
On the command line, tzdiff shows the gap between zones for today and timecheck turns a unix timestamp into readable time. Both are small and one-purpose, in the style of the rest of the shelf.
written
9 min readHTML to image in Python with Playwright: 312 KB as PNG, 12.5 KB as WEBP
A headless browser turns an HTML snippet into a social card, a banner or a receipt. On 4 November 2026 the same 1200 x 630 card came out at 312 KB as PNG, 26.2 KB as JPEG and 12.5 KB as WEBP, and one browser drew 50 cards in 2.6 s where a browser per card took 38.9 s. The code, and the traps: a white margin, late fonts, a made-up bold, emoji as boxes and lost transparency.
14 min readGoogle Maps scraper in Python: 120 places a search, phones in the data, no review counts
A Google Maps search lists 120 places and stops. Signed out, most cards show no phone and almost none a review count, but the JSON the page loads has a phone for 65 to 100 % of the places. How to read it with Playwright within robots.txt, and what to clean before it goes into a CSV.
16 min readDownload all files from a website in Python: 964 file links and the traps we measured
We listed every file link on 12 public pages, 964 of them, and asked for 458 of them politely. The servers were tidy: 456 of 458 HEAD answers were 200 with the usual type. The traps sat elsewhere: a page that redirects, a robots.txt that answers 403, wildcard rules that urllib.robotparser misreads, a HEAD that says 0 bytes, and PDFs of almost 70 MB.