The Pain That Pushed Me Into Automation

As a freelancer, I had a monthly ritual: log in to Fiverr, Upwork, PayPal, and Stripe → download invoices → rename files → merge them → send to my accountant. It was the same repetitive nightmare every 30 days. One Saturday, I snapped and decided: Python is going to do this for me.

I didn't know it yet, but this small time-saving hack would turn into a tool people gladly paid for.

The First Script That Saved Me Hours

The MVP was scrappy: Selenium for login + download, and PyPDF2 to merge.

from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from PyPDF2 import PdfMerger

# Step 1: Login and download
driver = webdriver.Chrome()
driver.get("https://www.paypal.com/signin")
time.sleep(3)

driver.find_element(By.ID, "email").send_keys("myemail@example.com")
driver.find_element(By.ID, "btnNext").click()
print("PayPal invoices downloaded ✅")

# Step 2: Merge PDFs
merger = PdfMerger()
for pdf in ["paypal.pdf", "fiverr.pdf", "stripe.pdf"]:
    merger.append(pdf)
merger.write("monthly_report.pdf")
merger.close()

In half an hour, I had automated what used to take me half a day.

Automating the Schedule With Python

Running it manually was fine once — but I wanted autopilot. I used schedule to run it monthly:

import schedule, time, subprocess

def run_job():
    subprocess.run(["python", "invoices.py"])

schedule.every().month.at("09:00").do(run_job)

while True:
    schedule.run_pending()
    time.sleep(60)

Now invoices literally appeared in my folder every month without me touching a thing.

Making It Useful for Other Freelancers

A designer friend saw my script and begged: "Can I use this too? I hate invoices." Problem: she didn't know Python. Solution: I wrapped it in a Click CLI.

import click

@click.command()
@click.option("--platform", default="paypal", help="Which platform to fetch invoices")
def invoices(platform):
    click.echo(f"Fetching invoices from {platform}...")

if __name__ == "__main__":
    invoices()

Now anyone could run:

python invoices.py --platform=upwork

Emailing the Final Report Automatically

Accountants don't want files on your desktop — they want them in their inbox. I wired up smtplib to send reports:

import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["Subject"] = "Monthly Invoices"
msg["From"] = "me@example.com"
msg["To"] = "accountant@example.com"

msg.set_content("Attached is this month's invoice report.")
with open("monthly_report.pdf", "rb") as f:
    msg.add_attachment(f.read(), maintype="application", subtype="pdf", filename="report.pdf")

with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
    smtp.login("me@example.com", "mypassword")
    smtp.send_message(msg)

Now my accountant got the report before I even woke up.

Wrapping It in a Web Dashboard

Not everyone likes command-line tools. So I built a Flask dashboard with upload buttons and a "Generate Report" feature.

from flask import Flask, send_file
app = Flask(__name__)

@app.route("/invoices")
def invoices():
    return send_file("monthly_report.pdf")

app.run(port=5000)

Suddenly, my ugly script looked like a real product.

When Someone Offered to Pay Me

I gave it to a couple of friends for free. Then one said: "I'll pay $15/month if you just keep this running for me." That's when I integrated Stripe subscriptions into the Flask app.

Scaling Into a Micro-SaaS

To handle multiple users, I had to upgrade:

  • FastAPI for performance
  • Celery + Redis for background invoice jobs
  • PostgreSQL for storing reports
  • Docker + Nginx for deployment

Now, freelancers could log in, connect platforms, and get monthly reports — all automated.

The Day Python Became My Business Partner

That weekend script went from saving me two hours a month to covering my internet bill, then my groceries, then half my rent. Python wasn't just solving my problems anymore — it was quietly running a business for me.

A message from our Founder

Hey, Sunil here. I wanted to take a moment to thank you for reading until the end and for being a part of this community.

Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? We don't receive any funding, we do this to support the community. ❤️

If you want to show some love, please take a moment to follow me on LinkedIn, TikTok, Instagram. You can also subscribe to our weekly newsletter.

And before you go, don't forget to clap and follow the writer️!