Skip to content
Snippets Groups Projects
Commit 5534d08e authored by Martin van Es's avatar Martin van Es
Browse files

Add mdproxy.py

parent 1dcc6135
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from flask import Flask, request
from urllib.parse import unquote
import requests
# import traceback
app = Flask(__name__)
# Find all IdP's in edugain metadata
cached = {}
signer = 'http://localhost:5001/sign'
@app.route('/cache', methods=['GET'])
def cache():
global cached
entity = unquote(request.args.get('id'))
if entity in cached:
print(f"serve {entity}")
return cached[entity]
else:
print(f"request {entity}")
result = requests.get(f"{signer}?id={entity}").text
cached[entity] = result
return result
app.run(host='0.0.0.0', port=5002)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment