Spaces:
Sleeping
Sleeping
Download test_visitor_email.py from dixitramjendra/MACD_Strategy: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/spaces/dixitramjendra/MACD_Strategy/resolve/main/test_visitor_email.py
- Command line
-
hf download hf://spaces/dixitramjendra/MACD_Strategy/test_visitor_email.py
-
curl -L -o test_visitor_email.py https://huggingface.co/spaces/dixitramjendra/MACD_Strategy/resolve/main/test_visitor_email.py
1.95 kB
| #!/usr/bin/env python3 | |
| """ | |
| Test script to send visitor report email | |
| Uses email configuration from user input | |
| """ | |
| import sys | |
| import os | |
| from pathlib import Path | |
| # Add current directory to path | |
| sys.path.insert(0, str(Path(__file__).parent)) | |
| from daily_visitor_report import DailyVisitorReport | |
| # Override email configuration | |
| os.environ['EMAIL_ADDRESS'] = 'biasbuster2026@gmail.com' | |
| os.environ['VISITOR_REPORT_EMAIL'] = 'biasbuster2026@gmail.com' | |
| # Note: You need to set EMAIL_PASSWORD | |
| # Get app password from: https://myaccount.google.com/apppasswords | |
| if __name__ == "__main__": | |
| print("=" * 60) | |
| print("📧 Visitor Report Email Test") | |
| print("=" * 60) | |
| print() | |
| # Check if password is set | |
| if not os.getenv('EMAIL_PASSWORD'): | |
| print("⚠️ EMAIL_PASSWORD not set!") | |
| print() | |
| print("To send emails, you need a Gmail App Password:") | |
| print("1. Go to: https://myaccount.google.com/apppasswords") | |
| print("2. Create an app password for 'Mail'") | |
| print("3. Set it in .env file:") | |
| print(" EMAIL_PASSWORD=your-16-char-app-password") | |
| print() | |
| print("Or set it temporarily:") | |
| print(" export EMAIL_PASSWORD='your-app-password'") | |
| print(" python3 test_visitor_email.py") | |
| print() | |
| sys.exit(1) | |
| # Create and send report | |
| report = DailyVisitorReport() | |
| print(f"📧 Sending visitor report to: {report.email_to}") | |
| print(f"📤 From: {report.email_from}") | |
| print() | |
| success = report.send_report() | |
| if success: | |
| print() | |
| print("=" * 60) | |
| print("✅ SUCCESS! Email sent successfully!") | |
| print("=" * 60) | |
| print() | |
| print("Check your inbox: biasbuster2026@gmail.com") | |
| else: | |
| print() | |
| print("=" * 60) | |
| print("❌ FAILED! Could not send email") | |
| print("=" * 60) | |
| print() | |
| print("Check the error messages above") | |