earthquake.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Automation-Bots 作者: ab-anand 项目源码 文件源码
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'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号