Change in files organization
Readme updates fix bu in env.py
This commit is contained in:
parent
56e123b237
commit
1d376d6b56
19
README.md
19
README.md
@ -17,20 +17,18 @@ This Python project automates the process of organizing a Secret Santa event. It
|
|||||||
```bash
|
```bash
|
||||||
secret-santa/
|
secret-santa/
|
||||||
│
|
│
|
||||||
├── config/
|
|
||||||
│ └── env.py # Configuration settings (SMTP, file paths, etc.)
|
|
||||||
│
|
|
||||||
├── src/
|
├── src/
|
||||||
│ ├── draw.py # Logic for drawing names
|
│ ├── draw.py # Logic for drawing names
|
||||||
│ ├── emailer.py # Email sending functionality
|
│ ├── emailer.py # Email sending functionality
|
||||||
│ ├── file_io.py # File handling (CSV reading/writing)
|
│ ├── file_io.py # File handling (CSV reading/writing)
|
||||||
│ ├── main.py # Main program logic
|
│ ├── main.py # Main program logic
|
||||||
│ └── utils.py # Utility functions (date, time handling)
|
│ ├── utils.py # Utility functions (date, time handling)
|
||||||
|
│ └── env.py # Configuration settings (SMTP, file paths, etc.)
|
||||||
│
|
│
|
||||||
└── README.md # Project readme
|
└── README.md # Project readme
|
||||||
```
|
```
|
||||||
|
|
||||||
### `config/env.py`
|
### `src/env.py`
|
||||||
|
|
||||||
The configuration file contains SMTP settings, file paths, and customizable parameters for the draw.
|
The configuration file contains SMTP settings, file paths, and customizable parameters for the draw.
|
||||||
|
|
||||||
@ -40,7 +38,7 @@ Example `env.py`:
|
|||||||
SMTP_SERVER = "smtp.example.com"
|
SMTP_SERVER = "smtp.example.com"
|
||||||
SMTP_PORT = 25
|
SMTP_PORT = 25
|
||||||
SENDER_EMAIL = "santa@example.com"
|
SENDER_EMAIL = "santa@example.com"
|
||||||
CSV_FILE_PATH = "secret_santa_DB.csv"
|
CSV_FILE_PATH = r"secret_santa_DB.csv"
|
||||||
DRAW_PER_PERSON = 2 # Choose 1 or 2 recipients per person
|
DRAW_PER_PERSON = 2 # Choose 1 or 2 recipients per person
|
||||||
|
|
||||||
# Email content
|
# Email content
|
||||||
@ -68,12 +66,15 @@ This email was sent automatically, please do not reply.
|
|||||||
|
|
||||||
1. Clone the repository or download the script files.
|
1. Clone the repository or download the script files.
|
||||||
2. Ensure you have Python installed on your system. If not, download and install Python from [here](https://www.python.org/downloads/).
|
2. Ensure you have Python installed on your system. If not, download and install Python from [here](https://www.python.org/downloads/).
|
||||||
3. Set up the `env.py` file in the `config/` directory, adjusting the SMTP settings, CSV file path, and draw parameters as needed.
|
3. Set up the `env.py` file in the `src/` directory, adjusting the SMTP settings, CSV file path, and draw parameters as needed.
|
||||||
|
|
||||||
Example structure of the CSV file:
|
|
||||||
|
|
||||||
|
Example structure of the CSV file
|
||||||
|
with the following colunms
|
||||||
```csv
|
```csv
|
||||||
Name,Email,Last_Year_Recipient_1,Last_Year_Recipient_2
|
Name,Email,Last_Year_Recipient_1,Last_Year_Recipient_2
|
||||||
|
```
|
||||||
|
|
||||||
|
```csv
|
||||||
Alice,alice@example.com,Bob,Charlie
|
Alice,alice@example.com,Bob,Charlie
|
||||||
Bob,bob@example.com,Alice,David
|
Bob,bob@example.com,Alice,David
|
||||||
Charlie,charlie@example.com,David,Alice
|
Charlie,charlie@example.com,David,Alice
|
||||||
|
|||||||
@ -12,10 +12,11 @@ def draw_names(previous_draw, draws_per_person):
|
|||||||
new_draw = [] # Store new draw results
|
new_draw = [] # Store new draw results
|
||||||
|
|
||||||
for i in range(len(participants)):
|
for i in range(len(participants)):
|
||||||
|
giver = previous_draw[i][0]
|
||||||
|
email = previous_draw[i][1]
|
||||||
|
print(email)
|
||||||
last_year_r1 = previous_draw[i][2]
|
last_year_r1 = previous_draw[i][2]
|
||||||
last_year_r2 = previous_draw[i][3]
|
last_year_r2 = previous_draw[i][3]
|
||||||
giver = previous_draw[i][0]
|
|
||||||
email = previous_draw[i][1]
|
|
||||||
|
|
||||||
available_participants = participants.copy()
|
available_participants = participants.copy()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import smtplib
|
import smtplib
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from config.env import SMTP_SERVER, SMTP_PORT, SENDER_EMAIL
|
from env import SMTP_SERVER, SMTP_PORT, SENDER_EMAIL
|
||||||
|
|
||||||
def send_email(receiver_email, subject, msg):
|
def send_email(receiver_email, subject, msg):
|
||||||
"""
|
"""
|
||||||
|
|||||||
10
src/main.py
10
src/main.py
@ -1,8 +1,8 @@
|
|||||||
from config.env import CSV_FILE_PATH, DRAW_PER_PERSON, EMAIL_SUBJECT, EMAIL_BODY
|
from env import CSV_FILE_PATH, DRAW_PER_PERSON, EMAIL_SUBJECT, EMAIL_BODY
|
||||||
from src.file_io import open_csv, save_csv
|
from file_io import open_csv, save_csv
|
||||||
from src.draw import draw_names
|
from draw import draw_names
|
||||||
from src.emailer import send_email
|
from emailer import send_email
|
||||||
from src.utils import get_current_time
|
from utils import get_current_time
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
def send_all_emails(new_draw):
|
def send_all_emails(new_draw):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user