From d72a0c13c5459d12ece1c9abe9c6f65654788f44 Mon Sep 17 00:00:00 2001 From: Sochen Date: Sat, 7 Mar 2026 01:08:50 +0000 Subject: [PATCH] Clean up: remove dead Telnyx statuses, doula references, personal info, fix README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove legacy Telnyx status strings (delivered, sent, queued, sending) - Remove duplicate save_log/generate_report calls in main() - Remove hardcoded personal fax number from GUI placeholder - Replace "doula coverage claim" with generic "claim" in HTML reports - Fix README: "7 days" → "3 successful deliveries", remove unnecessary number purchase step Co-Authored-By: Claude Opus 4.6 --- README.md | 9 ++++----- autofax.py | 24 ++++++++++-------------- gui.py | 10 +++++----- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 016068d..5c2fd8a 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,9 @@ This produces `dist/AutoFax.exe` -- a single self-contained file you can copy to ## Sinch Account Setup 1. Sign up at [dashboard.sinch.com](https://dashboard.sinch.com/) -2. Go to **Numbers** and purchase a fax-enabled number -3. Go to **Settings > Access Keys** and create a key pair -4. Note your **Project ID** (shown at the top of the dashboard) -5. Configure: +2. Go to **Settings > Access Keys** and create a key pair +3. Note your **Project ID** (shown at the top of the dashboard) +4. Configure: ```bash cp .env.example .env @@ -60,7 +59,7 @@ This will: - Create a Python virtual environment - Install dependencies - Set up an hourly cron job -- Auto-remove the cron after 7 days +- Stop automatically after 3 successful deliveries ### 3. Manual Test diff --git a/autofax.py b/autofax.py index 402b33e..c016fe1 100755 --- a/autofax.py +++ b/autofax.py @@ -119,20 +119,20 @@ def generate_report(entries: list[dict]): config.REPORTS_DIR.mkdir(parents=True, exist_ok=True) total = len(entries) - success_statuses = {"QUEUED", "IN_PROGRESS", "COMPLETED", "delivered", "sent", "queued", "sending"} + success_statuses = {"QUEUED", "IN_PROGRESS", "COMPLETED"} failed = sum(1 for e in entries if e["status"] not in success_statuses) - succeeded = sum(1 for e in entries if e["status"] in ("COMPLETED", "delivered")) + succeeded = sum(1 for e in entries if e["status"] == "COMPLETED") pending = total - failed - succeeded rows = "" for i, e in enumerate(entries, 1): status = e["status"] - if status in ("COMPLETED", "delivered", "sent"): + if status == "COMPLETED": status_class = "success" - status_display = "DELIVERED" if status == "COMPLETED" else status.upper() - elif status in ("QUEUED", "IN_PROGRESS", "queued", "sending"): + status_display = "DELIVERED" + elif status in ("QUEUED", "IN_PROGRESS"): status_class = "pending" - status_display = status.upper() + status_display = status else: status_class = "failed" status_display = "FAILED" @@ -181,7 +181,7 @@ def generate_report(entries: list[dict]):

This report documents automated fax transmission attempts to the insurance - company for doula coverage claim processing.

+ company for claim processing.

Total attempts: {total} | Delivered: {succeeded} | @@ -210,9 +210,8 @@ def generate_report(entries: list[dict]):

""" @@ -224,7 +223,7 @@ def generate_report(entries: list[dict]): def update_previous_statuses(entries: list[dict]) -> list[dict]: for entry in entries: - if entry["status"] in ("QUEUED", "IN_PROGRESS", "queued", "sending"): + if entry["status"] in ("QUEUED", "IN_PROGRESS"): status_data = check_fax_status(entry.get("fax_id")) if status_data: new_status = status_data.get("status", entry["status"]) @@ -285,7 +284,6 @@ def main(): break print() - save_log(entries) report_path = generate_report(entries) # Notify via ntfy @@ -308,8 +306,6 @@ def main(): print(f"Report: {report_path}") # Check if this delivery hit the target - save_log(entries) - generate_report(entries) check_done(entries) if result["status"] == "send_failed": diff --git a/gui.py b/gui.py index 818f8c2..7b60aca 100644 --- a/gui.py +++ b/gui.py @@ -106,7 +106,7 @@ class AutoFaxApp: self.to_var = tk.StringVar() self.pdf_var = tk.StringVar() - self._add_field(lf_fax, "To Number:", self.to_var, placeholder="+18019382102") + self._add_field(lf_fax, "To Number:", self.to_var, placeholder="+1XXXXXXXXXX") pdf_frame = tk.Frame(lf_fax) pdf_frame.pack(fill="x", pady=2) @@ -208,7 +208,7 @@ class AutoFaxApp: if not self.key_secret_var.get().strip(): problems.append("Key Secret is required") to_num = self.to_var.get().strip() - if not to_num or to_num == "+18019382102": + if not to_num or to_num == "+1XXXXXXXXXX": problems.append("To Number is required") pdf = self.pdf_var.get().strip() if not pdf or not Path(pdf).is_file(): @@ -447,7 +447,7 @@ tr:nth-child(even){{background:#f9f9f9}}

Fax Transmission Report

This report documents automated fax transmission attempts to the insurance -company for doula coverage claim processing.

+company for claim processing.

Total attempts: {total} | Delivered: {succeeded} | Failed: {failed} | @@ -462,8 +462,8 @@ Pending: {pending}

{rows} +transmission attempt. Faxes are sent once per hour. +FAILED = the receiving fax machine did not accept.

""" (REPORTS_DIR / "fax_report.html").write_text(html)