Skip to content

Instantly share code, notes, and snippets.

@Depado
Depado / periodic.py
Last active February 23, 2023 09:44
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):