***The Problem is that the Key "4255" always refreshes when i type it in the console and it never expires, and how can i set the expiration date for many keys and not only one.
I want the Key to expire in the 1 minute and store that information somewhere so it doesnt refresh everytime i reuse the key.***
import random
from datetime import datetime, timedelta
def generate_key():
key = str("4255")
expiration_time = datetime.now() + timedelta(days=0, minutes=1) #Key expires in 1 day and 30 minutes
return key, expiration_time
def is_expired(expiration_time):
return datetime.now() > expiration_time
correct_key, expiration_time = generate_key()
print("# Generated key", correct_key)
user_input = input("Enter your license Key:")
if expiration_time == timedelta:
print("your425 Key expired", (expiration_time))
if user_input == correct_key:
print("Successfully Loaded")
if user_input == correct_key:
print("Expiration:",(expiration_time))
else:
print("Key Expired")
input("Press any Key to close")
The Key Should start the expiration date at the first use and somewhere store the information.