Automate the Boring Stuff with Python: 3 Modern Scripts (2026)
By Huzi
File #48 · 3 min read
Python automation is how the boring stuff gets done: this 2026 set carries the downloads-folder organiser, the async scraper and the bulk image resizer — the three scripts that earn their place on a hard drive — plus the one command that stitches them into a pipeline. Earlier versions of this post carried five scripts; two of them mostly duplicated library documentation, so they are gone.
The quick answer: Python 3.15 in a uv venv, three libraries — httpx, beautifulsoup4, Pillow — and the scripts below cover organising, scraping and resizing. Together they quietly become the back office of a small shop.
Setup, once
Python 3.15 from python.org, then a virtual environment with uv, the fast modern installer:
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install httpx beautifulsoup4 Pillow
1. Tame the Downloads folder with pathlib
from pathlib import Path
from shutil import move
def organize(directory: Path) -> None:
for file in directory.iterdir():
if file.is_file() and file.suffix:
target = directory / file.suffix.lstrip(".").lower()
target.mkdir(exist_ok=True)
move(file, target / file.name)
organize(Path.home() / "Downloads")
Sixty files of chaos become folders named pdf, zip and xlsx. pathlib keeps the code cross-platform — Path.home() resolves correctly on Windows, macOS and Linux without a single conditional.
2. Scrape without the wait, with httpx
import asyncio, httpx
from bs4 import BeautifulSoup
async def fetch_headlines() -> list[str]:
async with httpx.AsyncClient(timeout=10.0) as client:
r = await client.get("https://news.ycombinator.com")
r.raise_for_status()
soup = BeautifulSoup(r.text, "html.parser")
return [a.get_text(strip=True) for a in soup.select("span.titleline > a")]
for i, title in enumerate(asyncio.run(fetch_headlines()), 1):
print(f"{i}. {title}")
The synchronous requests habit works, but the async habit scales: point the same AsyncClient at a list of two hundred URLs with asyncio.gather and the loop finishes before the kettle does.
3. Resize a whole folder with Pillow
from pathlib import Path
from PIL import Image
def resize_all(source: Path, output: Path, width: int) -> None:
output.mkdir(parents=True, exist_ok=True)
for img_path in source.glob("*"):
if img_path.suffix.lower() in {".png", ".jpg", ".jpeg", ".webp"}:
with Image.open(img_path) as img:
ratio = width / img.width
new = img.resize((width, int(img.height * ratio)),
Image.Resampling.LANCZOS)
new.save(output / img_path.name)
The with block matters more than it looks — it releases the file handle even when an image is corrupt. LANCZOS is the resampling filter that keeps text in screenshots readable. Point it at a source_images folder, run it once, and every Reel-sized asset your shop needs is ready in seconds.
Stitch them together
| The script | The job | The hero |
|---|---|---|
| Downloads organiser | Chaos into folders by file type | pathlib |
| Async scraper | Headlines without the wait | httpx with BeautifulSoup |
| Bulk resizer | Reel-sized assets in seconds | Pillow with LANCZOS |
These three are LEGO bricks: scrape a page of prices, resize the product photos, organise the output by date, and you have the bones of an e-commerce back office in an afternoon.
An afternoon of scripting buys back every evening after it. Reclaimed evenings are the raw material of travel — HTG Travel sees the results each season: shops that ran themselves while their owners finally took the weekend.
Pro tip: Wrap the scraper in a
try/except httpx.HTTPError— the network's worst day becomes a log line instead of a crash. Schedule what survives with cron on Linux or Task Scheduler on Windows, and the boring stuff simply stops appearing on your desk.
When your cron job survives a restart, thank reliability engineering; when Gaza's coders keep a pipeline alive through weeks of cut power, that is the discipline automation only imitates. Sudan's coders automated around war itself — schedulers that queue uploads for whenever the internet returns — may their scripts soon run in a country boring enough for ordinary work.
Every hour a script saves is an hour with your name on it, and hours become weekends. Automate the boring; keep the mountains manual — when you are ready to move, HTG Travel will book the Thursday-to-Sunday northern road trip your calendar keeps deleting, or a remote month somewhere greener. WhatsApp +92 317 5054959.




