web_ui.py 文件源码

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

项目:Firefly 作者: Firefly-Automation 项目源码 文件源码
def dashbaord():
  '''
  date = datetime.now()
  cnn = 'http://rss.cnn.com/rss/cnn_topstories.rss'
  news = feedparser.parse(cnn)
  feed = []
  for item in news.get('items'):
    feed.append({'time':parser.parse(item['published']).astimezone(tz.gettz('America/Los_Angeles')).time().strftime("%I:%M %p"), 'title': item['title'], 'summary': item['summary_detail']['value'].split('<br')[0], 'link':item['links'][0]['href']})

  allViews = getAllDevices()
  allDevices = allViews.get('all_devices')
  weather = allDevices.get('UUID123')
  forecast = weather.get('value').get('forecast')
  forecast = {'value':forecast}
  current=weather.get('value').get('current')
  alerts = weather.get('value').get('alerts')

  for item in forecast.get('value'):
    item['icon'] = WEATHER_MAPPING.get(item.get('icon'))
  current['icon'] = WEATHER_MAPPING.get(current.get('icon'))

  return render_template('dashboard.html', weather=forecast, current=current, alerts=alerts, date=date, feed=feed)
  '''
  return render_template('ui.html')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号