Skip to content

Instantly share code, notes, and snippets.

@Depado
Depado / periodic.py
Last active May 1, 2024 16:08
Creating and executing a periodic task in Python with no additionnal module (without Celery)
# Only dependency needed
import threading
# Dependency for the task
import datetime
import time
# Function wrapper
def periodic_task(interval, times = -1):
def outer_wrap(function):