CTWing电信物联网平台HTTP消息推送
HTTP消息推送
订阅推送消息格式
示例
订阅管理
订阅消息接收服务Python代码
import json
from flask import Flask
from flask import request
import datetime
import socket
app = Flask(__name__)
@app.route("/he/data/push/global", methods=['POST'])
def he_data_push_global():
print('**** Receive Post Data *****')
data = request.get_data()
json_data = json.loads(data.decode("utf-8"))
print(json_data,type(json_data))
return 'POST SUCCESS'
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=8000)
{
'upPacketSN': -1,
'upDataSN': -1,
'topic': 'v1/up/ad19prof',
'timestamp': 1595993828880,
'tenantId': '2****10522',
'serviceId': '',
'protocol': 'lwm2m',
'productId': '****3387',
'payload':
{
'serviceId': 'UpdataToDev',
'serviceData': {
'VoltageCur': 374,
'TmpWidth': 100,
'TimePeriod': 10,
'MinCntSet': 1,
'IntData3': -9999,
'IntData2': 98,
'IntData1': 0,
'InfoId': 1,
'ICCID': '****205****47538',
'Extend2': 1969,
'Extend1': 24
}
},
'messageType': 'dataReport',
'deviceType': '',
'deviceId': '****f8ac4a9f4420a32a1e5****b3417',
'assocAssetId': '',
'IMSI': 'undefined',
'IMEI': '****6804283****'
}
<class 'dict'>
网友评论