# 所有的demo基于python实现

1.获取设备在线状态,以及信号值

# 接口名称: /api/v1/device/status/online

import requests
import json

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Basic MTU2MDM1OTYzNDU6aHVhbmcw==',    
    'Sign': '4tTPuWqy0UK0e7dIOkdyGMv4jhZsfgnL'              
}

data = {
    'deviceCode': '321123',                                 
    'channel': '123456',                                    
    'sign': '4tTPuWqy0UK0e7dIOkdyGMv4jhZsfgnL'              
}

r = requests.post(url='http://www.washpayer.com/api/v1/device/status/online', headers=headers, data=json.dumps(data))

2. 启动设备

# 接口名称: /api/v1/device/start

import requests
import json

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Basic MTU2MDM1OTYzNDU6aHVhbmcw==',    
    'Sign': '4tTPuWqy0UK0e7dIOkdyGMv4jhZsfgnL'              
}

data = {
    'deviceCode': '321123',
    'sign': '4tTPuWqy0UK0e7dIOkdyGMv4jhZsfgnL',
    'channel': '123456',
    'extOrderNo': '1234567890123',
    'createTime': '2020-10-10 23:59:59',
    'package': {     
        'time': 15,
        'price': 10,
        'coins': 10
    }
}

r = requests.post(url='http://www.washpayer.com/api/v1/device/start', headers=headers, data=json.dumps(data))