import whois ; import time ; from datetime import datetime ; import requests ; import re
date = False
points = 0
class bcolors: # just adding colors, ignore this
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def date_c():
if date:
print(f'{bcolors.OKGREEN}{td}Y{bcolors.ENDC}')
else:
print(f'{bcolors.FAIL}Less than a year{bcolors.ENDC}')
user_input = input('Site Link: ')
domain = whois.whois(user_input)
name = domain.domain_name[0]
d1 = domain.creation_date[0].strftime('%Y')
d2 = datetime.today().strftime('%Y')
td = int(d2) - int(d1)
if td >= 1:
points += 2
date = True
print(f'''
{'-' * (len(name) + 8)}
DOMAIN: {name}
| Age: {date_c()} # This is None, and the value is displayed outside from here
| Secure:
| Status:
| Emails:
| Address:
| City:
| Recently Updated:
{'-' * (len(name) + 8)}
''')
I am getting the age of google, then if the age(in years) is >= 1 then date = True, and if date = true, in the printf statement display it, but the value is outside and date_c is somehow None. Any help is appreciated!