12345678910111213141516171819 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- demeter service
- name:record.py 用于记录设备过来的数据
- author:rabin
- """
- from demeter import *
- class Record(object):
- def topic(self, key):
- array = key.split('/')
- return {'method':array[0], 'type':array[1], 'parent':array[2], 'child':array[3]}
- def push(self, key, value):
- config = self.topic(key)
- method = 'record_' + config['method']
- cls = Demeter.getClass(method, 'service.')
- cls().handle(config, value)
|