hbnet/dev/json_templates.py

140 lines
3.6 KiB
Python
Raw Normal View History

2021-04-21 22:16:03 -04:00
# Types: App, msg_xfer, raw
# Auth: public, private
import json
msg_xfer = {
'mode':'msg_xfer',
2021-04-22 18:21:13 -04:00
'system_shortcut':'ABC',
'server_name':'Test HBlink Network',
2021-04-21 22:16:03 -04:00
'response_url':'http://localhost:8093/api/',
'auth_type':'private',
'credentials': {
'user':'test_name',
'password':'passw0rd',
},
'data':{
1:{'source_id':1234,
'destination_id':3153591,
'slot':2,
'msg_type':'unit',
'msg_format':'motorola',
'message':'text of the message'
},
2:{'source_id':1234,
'destination_id':3153591,
'slot':2,
'msg_type':'unit',
'msg_format':'motorola',
'message':'text of the 2nd message'
}
}
}
json_object = json.dumps(msg_xfer, indent = 4)
2021-04-22 17:47:22 -04:00
print('-----------------------------------------')
print('msg_xfer')
2021-04-21 22:16:03 -04:00
print(json_object)
2021-04-22 17:47:22 -04:00
print('-----------------------------------------')
2021-04-21 22:16:03 -04:00
##msg_xfer_public = {
## 'mode':'msg_xfer',
## 'system_shortcut':'ABC',
## 'server_name':'Test HBlink Network',
## 'response_url':'http://localhost:8093/api/',
## 'auth_type':'public',
## 'auth_token':'1234567899',
## 'data':{
## 1:{'source_id':1234,
## 'destination_id':3153591,
## 'slot':2,
## 'msg_type':'unit',
## 'msg_format':'motorola',
## 'message':'text of the message'
## },
## 2:{'source_id':1234,
## 'destination_id':3153591,
## 'slot':2,
## 'msg_type':'unit',
## 'msg_format':'motorola',
## 'message':'text of the 2nd message'
## }
##
## }
##
##}
##
##json_object = json.dumps(msg_xfer_public, indent = 4)
##print('-----------------------------------------')
##print('msg_xfer public')
##print(json_object)
##print('-----------------------------------------')
2021-04-21 22:16:03 -04:00
app_request = {
'mode':'app',
2021-04-22 18:21:13 -04:00
'system_shortcut':'ABC',
'server_name':'Test HBlink Network',
2021-04-21 22:16:03 -04:00
'response_url':'http://localhost:8093/api/',
'auth_token':'1234567899',
'data':{
'source_id':1234,
'slot':2,
'msg_type':'unit',
'msg_format':'motorola',
'message':'text of the message'
}
}
2021-04-22 17:47:22 -04:00
json_object = json.dumps(app_request, indent = 4)
print('-----------------------------------------')
print('app, request, sent to the APP server')
2021-04-21 22:16:03 -04:00
print(json_object)
2021-04-22 17:47:22 -04:00
print('-----------------------------------------')
2021-04-21 22:16:03 -04:00
app_response = {
'mode':'app',
2021-04-22 18:21:13 -04:00
'app_name':'Test HBlink App',
2021-04-22 17:47:22 -04:00
'auth_token':'736a9ced7e7688c951490a7f8e1ebdd4',
2021-04-21 22:16:03 -04:00
'data':{
2021-04-22 17:47:22 -04:00
1:{'source_app':'app_name',
2021-04-21 22:16:03 -04:00
'destination_id':3153591,
'slot':2,
'msg_type':'unit',
'msg_format':'motorola',
'message':'text of the message'
},
2021-04-22 17:47:22 -04:00
2:{'source_id':'app_name',
2021-04-21 22:16:03 -04:00
'destination_id':3153591,
'slot':2,
'msg_type':'unit',
'msg_format':'motorola',
'message':'text of the 2nd message'
}
}
}
2021-04-22 17:47:22 -04:00
json_object = json.dumps(app_response, indent = 4)
print('-----------------------------------------')
print('app, response, sent to your dashboard')
2021-04-21 22:16:03 -04:00
print(json_object)
2021-04-22 17:47:22 -04:00
print('-----------------------------------------')
raw_msg_xfer = {
2021-04-22 13:03:48 -04:00
'mode':'raw',
2021-04-22 18:21:13 -04:00
'system_shortcut':'ABC',
2021-04-22 13:03:48 -04:00
'response_url':'http://localhost:8093/api/',
'auth_type':'private',
'credentials': {
'user':'test_name',
'password':'passw0rd',
},
'data':{
1:{'MMDVM Packet 1'},
2:{'MMDVM Packet 2'}
}
}