Skip to content

Commit

Permalink
updating api key to and endpoint to match
Browse files Browse the repository at this point in the history
  • Loading branch information
rabellino-noaa committed Jun 28, 2024
1 parent c18baaf commit 0fe019c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/idsse_testing/ims_service/src/ims_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@
from flask import Flask, request, jsonify

app = Flask(__name__)
app.config['GSL_KEY'] = 'GSL_234386fd-eb0a-408f-9ea2-149506a742bf'
app.config['GSL_KEY'] = '8209c979-e3de-402e-a1f5-556d650ab889'

# The joined profiles from the JSON examples...
ims_request = {'errors': [], 'profiles': []}


@app.route('/all_events', methods=['GET'])
@app.route('/all-events', methods=['GET'])
def profiles():
# First check for the key argument and that it matches the expected value...
if request.headers.get("X-Api-Key") != app.config['GSL_KEY']:
return jsonify({"message": "ERROR: Unauthorized"}), 401

if len(request.args.keys()) != 1 or request.args.get('dataSource') != 'NBM':
return jsonify({"message": "Bad Request : Invalid argument!"}), 400
# add one more check for ANY (currently IMS Gateway Request is using 'ANY')
if request.args.get('dataSource') != 'ANY':
return jsonify({"message": "Bad Request : Invalid argument!"}), 400

# Return the profiles...
return jsonify(ims_request)
Expand Down Expand Up @@ -59,6 +61,7 @@ def response():
for file in glob('*.json', root_dir=profile_dir)
]

print('Loading canned support profiles from:', json_files)
# json_files = sorted(glob('../profiles/*.json'))
for json_file in json_files:
with open(json_file, 'r', encoding="utf-8") as jf:
Expand Down

0 comments on commit 0fe019c

Please sign in to comment.