Skip to content
Snippets Groups Projects
Commit e8f18e92 authored by Vladimír Višňovský's avatar Vladimír Višňovský
Browse files

Delete modules.py

parent b3339582
No related branches found
No related tags found
2 merge requests!8Development,!7Remodule (v1.0 -> v1.1)
import os
import requests
from __main__ import login_manager
sys.path.insert(1, "/app")
from user import User
sys.path.insert(1, "/app/pmcff")
from db import get_connection
# Flask-Login helper to retrieve a user from db
@login_manager.user_loader
def load_user(user_id):
connection = get_connection(DATABASE)
return User.get(connection, user_id)
def get_provider_cfg():
return requests.get(DISCOVERY_URL).json()
def remove_deployment(user_id):
os.system(f'kubectl delete -f /srv/{user_id}')
def get_response(code):
provider_cfg = get_provider_cfg()
token_endpoint = provider_cfg["token_endpoint"]
client_auth = requests.auth.HTTPBasicAuth(CLIENT_ID, CLIENT_SECRET)
post_data = {"grant_type": "authorization_code",
"code": code,
"redirect_uri": REDIRECT_URI}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(token_endpoint,
auth=client_auth,
headers=headers,
data=post_data)
return response
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment