Home/Answers/Notification when a Python script finishes
Answer

How do I get a notification when my Python script finishes?

Add one HTTP POST to your Lert link at the end of the script. Wrap it in a try/finally so it fires whether the run succeeds or crashes — your iPhone buzzes in about a second. No account, no API keys, no SDK. Setup takes under 30 seconds.

You start a Python script, then wander off to do something else. The question is how to know the moment it's done — without babysitting the terminal. The answer is to have the script tell your phone directly. Lert makes that a single line: your unique link is the credential, so there's no auth, no library, and nothing to configure.

Set it up in under 30 seconds

  1. Download the app. Open it once — there's no account to create.
  2. Copy your link. A private link like https://lert.dev/p/your-id is on screen; one tap copies it.
  3. Add one POST at the end of your script. Put it in a try/finally block so it fires on success and on failure.

That's it. When the script ends, your phone buzzes — even locked in your pocket.

The code

python
import requests

def notify(title, body):
    requests.post("https://lert.dev/p/your-id",
                  json={"title": title, "body": body})

try:
    run_my_job()            # your actual work
    notify("Script done", "Finished with no errors")
except Exception as e:
    notify("Script failed", str(e))
    raise

No headers beyond JSON, no auth token, no SDK to install. Not a Python person? Tell your AI assistant: "POST to my Lert link when this script finishes — here's the link." It'll wire it in.

Why try/finally: the whole point of a "did it finish?" ping is that it fires even when the job blows up. Catching the exception (and re-raising) means you get told about crashes too — which is usually when you most want to know.

Related things people wire up

It's free for one channel and 50 notifications a day; Lert Pro is $2.99/month for unlimited. See the docs for the full API.

Send your first one in 30 seconds.

Download Lert, copy your link, POST to it. Your iPhone buzzes.

Get the app iOS