DEV Community

Alex Spinov
Alex Spinov

Posted on

I Automated My Entire Morning Routine with 5 Python Scripts (Here's the Code)

Every morning I used to spend 45 minutes doing the same things: checking weather, scanning news headlines, reviewing my calendar, checking stock prices, and reading emails.

Then I wrote 5 Python scripts that do it all in 12 seconds. Here's every line of code.

1. Weather Briefing (No API Key)

Most tutorials tell you to sign up for OpenWeatherMap. Forget that. Open-Meteo gives you weather data with zero registration:

import requests

def morning_weather(lat=55.75, lon=37.62):
    url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&current=temperature_2m,wind_speed_10m,precipitation&daily=temperature_2m_max,temperature_2m_min&timezone=auto"
    data = requests.get(url).json()
    current = data["current"]
    daily = data["daily"]

    print(f"🌡 Now: {current['temperature_2m']}°C")
    print(f"💨 Wind: {current['wind_speed_10m']} km/h")
    print(f"🌧 Precipitation: {current['precipitation']} mm")
    print(f"📅 Today: {daily['temperature_2m_min'][0]}° — {daily['temperature_2m_max'][0]}°")

    if current['precipitation'] > 0:
        print("☔ Take an umbrella!")
    if current['wind_speed_10m'] > 30:
        print("🌪 Strong wind — dress warm!")

morning_weather()
Enter fullscreen mode Exit fullscreen mode

Why this matters: Open-Meteo has no rate limits, no API key, and supports 7-day forecasts. I've been using it for 8 months without a single downtime.

2. News Headlines Scanner

I used to scroll through 4 news sites. Now one script gives me top stories from Hacker News — the only feed that actually matters for tech:

import requests

def top_news(n=10):
    ids = requests.get("https://hacker-news.firebaseio.com/v0/topstories.json").json()[:n]

    print(f"\n📰 Top {n} HN Stories:\n")
    for i, story_id in enumerate(ids, 1):
        story = requests.get(f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json").json()
        score = story.get("score", 0)
        title = story.get("title", "")
        url = story.get("url", "")
        comments = story.get("descendants", 0)

        print(f"{i}. [{score}{comments}💬] {title}")
        if url:
            print(f"   {url}\n")

top_news()
Enter fullscreen mode Exit fullscreen mode

The trick: I sort by score, not time. If something has 500+ upvotes at 7am, it's worth reading. Everything else is noise.

3. Stock Portfolio Check

I track 5 stocks. Used to open Yahoo Finance, wait for ads to load, click through each ticker. Now:

import requests

def check_stocks(tickers=["AAPL", "GOOGL", "MSFT", "NVDA", "TSLA"]):
    print("\n📈 Portfolio Check:\n")

    for ticker in tickers:
        url = f"https://query1.finance.yahoo.com/v8/finance/chart/{ticker}?interval=1d&range=5d"
        headers = {"User-Agent": "Mozilla/5.0"}

        try:
            data = requests.get(url, headers=headers).json()
            result = data["chart"]["result"][0]
            meta = result["meta"]
            price = meta["regularMarketPrice"]
            prev = meta["chartPreviousClose"]
            change = ((price - prev) / prev) * 100

            emoji = "🟢" if change >= 0 else "🔴"
            print(f"{emoji} {ticker}: ${price:.2f} ({change:+.2f}%)")
        except:
            print(f"⚠️ {ticker}: data unavailable")

check_stocks()
Enter fullscreen mode Exit fullscreen mode

Real talk: I don't day-trade. I just want to know if something dropped 10% so I can buy more. This script flags anomalies — everything else I ignore.

4. GitHub Activity Summary

As someone who maintains 250+ repos, I need to know what happened overnight:

import requests

def github_activity(username="spinov001-art"):
    events = requests.get(f"https://api.github.com/users/{username}/received_events?per_page=20").json()

    print(f"\n🐙 GitHub Activity:\n")

    stars = [e for e in events if e["type"] == "WatchEvent"]
    forks = [e for e in events if e["type"] == "ForkEvent"]
    issues = [e for e in events if e["type"] == "IssuesEvent"]

    if stars:
        print(f"{len(stars)} new stars")
        for s in stars[:3]:
            print(f"{s['repo']['name']}")

    if forks:
        print(f"🍴 {len(forks)} forks")

    if issues:
        print(f"🐛 {len(issues)} new issues")
        for i in issues[:3]:
            print(f"{i['repo']['name']}: {i['payload']['issue']['title'][:50]}")

    if not (stars or forks or issues):
        print("   Quiet night. Time to promote!")

github_activity()
Enter fullscreen mode Exit fullscreen mode

5. The Master Script (Ties Everything Together)

import time

def morning_briefing():
    start = time.time()

    print("=" * 50)
    print("☀️  MORNING BRIEFING")
    print("=" * 50)

    morning_weather()
    top_news(5)
    check_stocks()
    github_activity()

    elapsed = time.time() - start
    print(f"\n⏱ Completed in {elapsed:.1f} seconds")
    print("=" * 50)

if __name__ == "__main__":
    morning_briefing()
Enter fullscreen mode Exit fullscreen mode

What I Learned

45 minutes → 12 seconds. That's not a typo.

The key insight: every API I use is free and keyless. No registration, no OAuth dance, no expired tokens at 7am when you need your briefing.

Here's what I'd add next:

  • Email summary using IMAP (but requires credentials)
  • Calendar events via CalDAV
  • Crypto prices using CoinGecko API (also free, no key)

If you want the full repo with all scripts packaged and ready to run: github.com/spinov001-art/python-morning-briefing


What's in YOUR morning automation? I'm curious what repetitive tasks other developers have scripted away. Drop a comment 👇

I write about Python automation and free APIs. Follow me for weekly tutorials that actually save you time.

Top comments (0)