geo.py 文件源码

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

项目:beastcraft-telemetry 作者: ab77 项目源码 文件源码
def write_db(dbc, rpt, domain=None, key=None):
    l = []
    for measurement, value in rpt.iteritems():
        t = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
        if measurement not in ['class', 'device']:
          json_body = {
              'measurement': measurement,
              'tags': {
                  'class': rpt['class'],
                  'device': rpt['device']
              },
              'time': t,
              'fields': {
                  'value': value
              }
          }
          l.append(json_body)

    print('Write points: {0}'.format(l))
    dbc.write_points(l)
    update_dns(coords=rpt['geo'], domain=domain, key=key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号