DeveloperBreeze

Automate Attendance Development Tutorials, Guides & Insights

Unlock 1+ expert-curated automate attendance tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your automate attendance skills on DeveloperBreeze.

Build a Facial Recognition Attendance System

Tutorial December 10, 2024
python

import sqlite3

# Connect to SQLite database
conn = sqlite3.connect("attendance.db")
cursor = conn.cursor()

# Create table
cursor.execute("""
    CREATE TABLE IF NOT EXISTS attendance (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        name TEXT,
        timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
    )
""")

def log_attendance(name):
    cursor.execute("INSERT INTO attendance (name) VALUES (?)", (name,))
    conn.commit()

# Update the webcam loop to log attendance
if name not in attendance_log:
    attendance_log.add(name)
    log_attendance(name)
    print(f"{name} marked present in the database!")

Use schedule to automate the script to run at specific times (e.g., every morning):