def get_c_e_data(chooseyear):
date_data = dict(year=[{"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"??", "cValue":0, "eValue":0}, {"name":"???", "cValue":0, "eValue":0}, {"name":"???", "cValue":0, "eValue":0}], c_date=[], e_date=[])
standard_year = 2003
for year in range(standard_year, chooseyear+1):
date_data['c_date'].append({"name": year,"value":0})
date_data['e_date'].append({"name": year, "value": 0})
data = whois.select(whois.creation_date).where(whois.creation_date != '')
for date in data:
try:
try:
time = arrow.get(date.creation_date, 'DD-MMM-YYYY')
date_data['c_date'][time.year-standard_year]['value'] += 1
if time.year == chooseyear:
date_data['year'][time.month-1]["cValue"] += 1
except:
time = arrow.get(date.creation_date)
date_data['c_date'][time.year - standard_year]['value'] += 1
if time.year == chooseyear:
date_data['year'][time.month - 1]["cValue"] += 1
except:
pass
data1 = whois.select(whois.expiration_date).where(whois.expiration_date != '')
for date in data1:
try:
try:
time = arrow.get(date.expiration_date, 'DD-MMM-YYYY')
date_data['e_date'][time.year - standard_year]['value'] += 1
if time.year == chooseyear:
date_data['year'][time.month - 1]["eValue"] += 1
except:
time = arrow.get(date.expiration_date)
date_data['e_date'][time.year - standard_year]['value'] += 1
if time.year == chooseyear:
date_data['year'][time.month - 1]["eValue"] += 1
except:
pass
return json.dumps(date_data, ensure_ascii=False)
# 4.2?????????????? ?????
评论列表
文章目录