14 lines
493 B
Python
Executable file
14 lines
493 B
Python
Executable file
import os
|
|
import time
|
|
|
|
def should_api_be_triggered(file_path, period_of_time):
|
|
try:
|
|
# Get the last modification time of the file
|
|
modification_time = os.path.getmtime(file_path)
|
|
# Get the current time
|
|
current_time = time.time()
|
|
# Check if the file has been modified in the last hour (3600 seconds)
|
|
return (current_time - modification_time) <= period_of_time
|
|
except FileNotFoundError:
|
|
print("File not found.")
|
|
return False
|