File size: 758 Bytes
47a377e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import csv
from datetime import datetime
import os
def log_application(job_data, resume):
# Ensure data directory exists
os.makedirs("data", exist_ok=True)
file_path = "data/applications.csv"
# If file doesn't exist, write headers
write_header = not os.path.exists(file_path)
with open(file_path, "a", newline="", encoding="utf-8") as file:
writer = csv.writer(file)
if write_header:
writer.writerow(["title", "company", "location", "date_applied", "resume"])
writer.writerow([
job_data.get("title", ""),
job_data.get("company", ""),
job_data.get("location", ""),
datetime.now().isoformat(),
resume
])
|