Fun with Python: Today in History

Hey everyone,

Happy Saturday! I haven't done a "Fun with Python" post in a little while, so I wanted to share a small, fun project I put together: a script that shows you what happened on this day in history, right in your terminal.


Fun with Python: Today in History

The idea was to create a simple script that fetches historical events for the current date and displays them in a clean, readable format. It's a fun little project that involves interacting with a web API, parsing JSON, and presenting dataβ€”all common and useful Python tasks.

The Script

The script uses the requests library to fetch data from the "On This Day" public API and the rich library to make the terminal output look great. As with all my tools, it's set up to be run easily with uv run, so you don't have to worry about managing a virtual environment manually.

It grabs the current date, then makes separate API calls to get the top five historical events, births, and deaths for that day.

The Result

After a few tweaks, the final output is a nicely formatted summary that's easy to read at a glance.

Today In History

It’s a simple but satisfying project, and a great example of how you can use Python to pull interesting information from the web and create your own custom command-line tools.

You can find the complete, updated script in the Gist below if you'd like to try it out yourself.

As always,
Michael Garcia a.k.a. TheCrazyGM

0.15588761 BEE
3 comments

I love these little "project builder" scripts - speaking of we might need a reorg on project builder to add sections, one of these days πŸ˜…

!PAKX
!PIMP
!PIZZA

0.00831910 BEE

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (2/2 calls)



Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

0.00020007 BEE

Very cool tool, my friend. I love the idea of custom command-line tools. I make simpler tools using Bash scripts and aliases, which I've certainly found very useful. 😁 πŸ™ πŸ’š ✨ πŸ€™

0.00019974 BEE

PIZZA!

$PIZZA slices delivered:
@ecoinstant(2/20) tipped @thecrazygm

Come get MOONed!

0.00019607 BEE