Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -529,7 +529,41 @@ def get_roster(job_id):
|
|
| 529 |
except Exception as e:
|
| 530 |
logger.error(f"Error getting roster for {job_id}: {e}", exc_info=True)
|
| 531 |
return jsonify({"error": "Internal server error"}), 500
|
| 532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
# === Run Server ===
|
| 534 |
if __name__ == "__main__":
|
| 535 |
logger.info("Starting Flask application...")
|
|
|
|
| 529 |
except Exception as e:
|
| 530 |
logger.error(f"Error getting roster for {job_id}: {e}", exc_info=True)
|
| 531 |
return jsonify({"error": "Internal server error"}), 500
|
| 532 |
+
# === NEW DEBUGGING ROUTE ===
|
| 533 |
+
@app.route("/test_email", methods=["GET"])
|
| 534 |
+
def test_email():
|
| 535 |
+
"""A simple endpoint to test sending emails to specific addresses."""
|
| 536 |
+
# Ensure you have access to your logger and send_email function
|
| 537 |
+
logger.info("--- STARTING EMAIL TEST ---")
|
| 538 |
+
|
| 539 |
+
# Test case 1: The email that works
|
| 540 |
+
logger.info("TEST 1: Sending to the known working address...")
|
| 541 |
+
res1 = send_email("rairorr@gmail.com", "API Test 1 (Working)", "<p>This is a test.</p>")
|
| 542 |
+
status1 = "Success" if res1 else "Failed"
|
| 543 |
+
|
| 544 |
+
# Test case 2: The email that fails
|
| 545 |
+
logger.info("TEST 2: Sending to the known failing address...")
|
| 546 |
+
res2 = send_email("nharingosheperd@gmail.com", "API Test 2 (Failing)", "<p>This is a test.</p>")
|
| 547 |
+
status2 = "Success" if res2 else "Failed"
|
| 548 |
+
|
| 549 |
+
# Test case 3: The modified email to bypass a simple string filter
|
| 550 |
+
logger.info("TEST 3: Sending to a modified version of the failing address...")
|
| 551 |
+
res3 = send_email("nharingosheperd+test@gmail.com", "API Test 3 (Modified)", "<p>This is a test.</p>")
|
| 552 |
+
status3 = "Success" if res3 else "Failed"
|
| 553 |
+
|
| 554 |
+
# Test case 3: The modified email to bypass a simple string filter
|
| 555 |
+
logger.info("TEST 3: Sending to a modified version of the failing address...")
|
| 556 |
+
res3 = send_email("initiumzim@gmail.com", "API Test 3 (Modified)", "<p>This is a test.</p>")
|
| 557 |
+
status3 = "Success" if res3 else "Failed"
|
| 558 |
+
|
| 559 |
+
logger.info("--- FINISHED EMAIL TEST ---")
|
| 560 |
+
|
| 561 |
+
return jsonify({
|
| 562 |
+
"test_1_working_email": status1,
|
| 563 |
+
"test_2_failing_email": status2,
|
| 564 |
+
"test_3_modified_email": status3,
|
| 565 |
+
"test_4_modified_email": status4,
|
| 566 |
+
}), 200
|
| 567 |
# === Run Server ===
|
| 568 |
if __name__ == "__main__":
|
| 569 |
logger.info("Starting Flask application...")
|