change API field
This commit is contained in:
parent
7b2b33b2d9
commit
830799db2c
@ -176,6 +176,7 @@ def build_config(_config_file):
|
|||||||
'ACCESS_SYSTEMS_FILE': config.get(section, 'ACCESS_SYSTEMS_FILE'),
|
'ACCESS_SYSTEMS_FILE': config.get(section, 'ACCESS_SYSTEMS_FILE'),
|
||||||
'MY_API_NAME': config.get(section, 'MY_API_NAME'),
|
'MY_API_NAME': config.get(section, 'MY_API_NAME'),
|
||||||
'DASHBOARD_URL': config.get(section, 'DASHBOARD_URL'),
|
'DASHBOARD_URL': config.get(section, 'DASHBOARD_URL'),
|
||||||
|
'SERVER_NAME': config.get(section, 'SERVER_NAME'),
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -6,7 +6,8 @@ import json
|
|||||||
|
|
||||||
msg_xfer = {
|
msg_xfer = {
|
||||||
'mode':'msg_xfer',
|
'mode':'msg_xfer',
|
||||||
'system_name':'ABC',
|
'system_shortcut':'ABC',
|
||||||
|
'server_name':'Test HBlink Network',
|
||||||
'response_url':'http://localhost:8093/api/',
|
'response_url':'http://localhost:8093/api/',
|
||||||
'auth_type':'private',
|
'auth_type':'private',
|
||||||
'credentials': {
|
'credentials': {
|
||||||
@ -41,7 +42,8 @@ print('-----------------------------------------')
|
|||||||
|
|
||||||
app_request = {
|
app_request = {
|
||||||
'mode':'app',
|
'mode':'app',
|
||||||
'system_name':'ABC',
|
'system_shortcut':'ABC',
|
||||||
|
'server_name':'Test HBlink Network',
|
||||||
'response_url':'http://localhost:8093/api/',
|
'response_url':'http://localhost:8093/api/',
|
||||||
'auth_token':'1234567899',
|
'auth_token':'1234567899',
|
||||||
'data':{
|
'data':{
|
||||||
@ -61,7 +63,7 @@ print('-----------------------------------------')
|
|||||||
|
|
||||||
app_response = {
|
app_response = {
|
||||||
'mode':'app',
|
'mode':'app',
|
||||||
'system_name':'APP',
|
'app_name':'Test HBlink App',
|
||||||
'auth_token':'736a9ced7e7688c951490a7f8e1ebdd4',
|
'auth_token':'736a9ced7e7688c951490a7f8e1ebdd4',
|
||||||
'data':{
|
'data':{
|
||||||
1:{'source_app':'app_name',
|
1:{'source_app':'app_name',
|
||||||
@ -88,7 +90,7 @@ print(json_object)
|
|||||||
print('-----------------------------------------')
|
print('-----------------------------------------')
|
||||||
raw_msg_xfer = {
|
raw_msg_xfer = {
|
||||||
'mode':'raw',
|
'mode':'raw',
|
||||||
'system_name':'ABC',
|
'system_shortcut':'ABC',
|
||||||
'response_url':'http://localhost:8093/api/',
|
'response_url':'http://localhost:8093/api/',
|
||||||
'auth_type':'private',
|
'auth_type':'private',
|
||||||
'credentials': {
|
'credentials': {
|
||||||
|
@ -176,6 +176,7 @@ AUTHORIZED_TOKENS_FILE: /tmp/hblink_auth_tokens.txt
|
|||||||
AUTHORIZED_USERS_FILE: /path/to/authorized_users.txt
|
AUTHORIZED_USERS_FILE: /path/to/authorized_users.txt
|
||||||
ACCESS_SYSTEMS_FILE: /path/to/access_systems.txt
|
ACCESS_SYSTEMS_FILE: /path/to/access_systems.txt
|
||||||
MY_API_NAME: ABC
|
MY_API_NAME: ABC
|
||||||
|
SERVER_NAME: Test HBLink Network
|
||||||
|
|
||||||
|
|
||||||
# The following options are used for the dashboard. The dashboard is optional.
|
# The following options are used for the dashboard. The dashboard is optional.
|
||||||
|
@ -255,7 +255,8 @@ def send_app_request(url, message, source_id):
|
|||||||
auth_token.close()
|
auth_token.close()
|
||||||
app_request = {
|
app_request = {
|
||||||
'mode':'app',
|
'mode':'app',
|
||||||
'system_name':CONFIG['GPS_DATA']['MY_API_NAME'],
|
'system_shortcut':CONFIG['GPS_DATA']['MY_API_NAME'],
|
||||||
|
'server_name':CONFIG['GPS_DATA']['SERVER_NAME'],
|
||||||
'response_url':CONFIG['GPS_DATA']['DASHBOARD_URL'] + '/api',
|
'response_url':CONFIG['GPS_DATA']['DASHBOARD_URL'] + '/api',
|
||||||
'auth_token':the_token,
|
'auth_token':the_token,
|
||||||
'data':{
|
'data':{
|
||||||
@ -275,7 +276,7 @@ def send_msg_xfer(url, user, password, message, source_id, dest_id):
|
|||||||
url = url + '/msg_xfer'
|
url = url + '/msg_xfer'
|
||||||
msg_xfer = {
|
msg_xfer = {
|
||||||
'mode':'msg_xfer',
|
'mode':'msg_xfer',
|
||||||
'system_name':CONFIG['GPS_DATA']['MY_API_NAME'],
|
'system_shortcut':CONFIG['GPS_DATA']['MY_API_NAME'],
|
||||||
'response_url':CONFIG['GPS_DATA']['DASHBOARD_URL'],
|
'response_url':CONFIG['GPS_DATA']['DASHBOARD_URL'],
|
||||||
'auth_type':'private',
|
'auth_type':'private',
|
||||||
'credentials': {
|
'credentials': {
|
||||||
|
@ -741,8 +741,8 @@ def api(api_mode=None):
|
|||||||
# Handle authorization
|
# Handle authorization
|
||||||
if api_data['auth_type'] == 'private':
|
if api_data['auth_type'] == 'private':
|
||||||
#Authenticate
|
#Authenticate
|
||||||
if api_data['system_name'] in authorized_users:
|
if api_data['system_shortcut'] in authorized_users:
|
||||||
if api_data['credentials']['user'] == authorized_users[api_data['system_name']]['user'] and api_data['credentials']['password'] == authorized_users[api_data['system_name']]['password']:
|
if api_data['credentials']['user'] == authorized_users[api_data['system_shortcut']]['user'] and api_data['credentials']['password'] == authorized_users[api_data['system_shortcut']]['password']:
|
||||||
print(api_data['credentials']['user'])
|
print(api_data['credentials']['user'])
|
||||||
print(api_data['credentials']['password'])
|
print(api_data['credentials']['password'])
|
||||||
for sms in api_data['data'].items():
|
for sms in api_data['data'].items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user