def earthquake_print(data):
for i in data['features']:
if i['id'] not in UPDATES:
UPDATES.append(i['id'])
print('___________________________________________________________________________________________________')
print(i['properties']['title'], end=' MAG: ')
print(Fore.RED+str(i['properties']['mag']))
print('Location:', i['properties']['place'])
alert = i['properties']['alert']
if alert == 'green':
print(Fore.RED + 'Type: ' + i['properties']['type'], end=' ')
elif alert == 'yellow':
print(Fore.YELLOW + 'Type: ' + i['properties']['type'], end=' ')
else:
print(Fore.BLUE + 'Type: ' + i['properties']['type'], end=' ')
ms = i['properties']['time']
print(datetime.datetime.fromtimestamp(ms/1000.0))
print('INFO:', i['properties']['url'])
评论列表
文章目录