DEV Community

Jeremy Reevese
Jeremy Reevese

Posted on

Build a Daily Report Generator Using Python + Notion API (Minimal Working Example)

For my first Dev.to post, I wanted to share something small, useful, and immediately applicable — a minimal Python script that automatically generates a daily report into Notion.

This is part of my ongoing effort to build in public while constructing my one-person company’s automation stack.

If you want a simple, beginner-friendly example of how to interact with the Notion API using Python, this is a great place to start.


🚀 What We’re Building

A tiny script that:

  • Reads your Notion API key
  • Writes a new entry into a Notion database
  • Automatically fills in today’s date
  • Adds a default “Daily Report” template text

No frameworks, no advanced tooling — just pure Python and a few lines of code.


📦 Requirements

You'll need:

  • A Notion API integration
  • A database in Notion
  • The database’s ID
  • Python 3.8+
  • The requests library

Install the dependency:

pip install requests

Enter fullscreen mode Exit fullscreen mode

🧪 Minimal Working Code Example

import requests
import datetime

NOTION_API_KEY = "YOUR_NOTION_SECRET_KEY"
DATABASE_ID = "YOUR_DATABASE_ID"

url = "https://api.notion.com/v1/pages"
headers = {
    "Authorization": f"Bearer {NOTION_API_KEY}",
    "Content-Type": "application/json",
    "Notion-Version": "2022-06-28"
}

today = datetime.date.today().isoformat()

payload = {
    "parent": {"database_id": DATABASE_ID},
    "properties": {
        "Name": {
            "title": [
                {
                    "text": {"content": f"Daily Report - {today}"}
                }
            ]
        },
        "Date": {
            "date": {"start": today}
        }
    },
    "children": [
        {
            "object": "block",
            "type": "paragraph",
            "paragraph": {
                "rich_text": [
                    {"type": "text", "text": {"content": "Today's Summary:\n"}}
                ]
            }
        }
    ]
}

response = requests.post(url, headers=headers, json=payload)

if response.status_code == 200:
    print("Page created successfully!")
else:
    print("Error:", response.text)

Enter fullscreen mode Exit fullscreen mode

📝 How to Use It

  1. Create a Notion integration
  2. Share your database with that integration
  3. Copy your database ID
  4. Replace the placeholders in the script
  5. Run:
python daily_report.py

Enter fullscreen mode Exit fullscreen mode

You should see a newly generated page appear in your Notion database.


🔧 Why This Matters

Small automation blocks like this are the building pieces of a larger system.

This script can be extended into:

  • A CLI tool
  • A daily cron job
  • An n8n / Make workflow
  • A FastAPI microservice
  • A full productivity dashboard

This is how tiny scripts gradually become part of a one-person company’s technical infrastructure.


📚 Full Source Code

I will upload the improved version + additional examples to GitHub later:

👉 (GitHub repo link placeholder — to be added)


💬 If You Want More

Let me know in the comments if you'd like tutorials on:

  • Notion API + Python advanced usage
  • Building automations for freelancers
  • n8n workflows
  • FastAPI microservices
  • GitHub Actions for productivity
  • One-person company engineering systems

This is the first post of many — thanks for reading, and happy building! 🚀

Top comments (0)