dashboard/helpers/kratos_api.py
2021-10-28 14:09:10 +00:00

32 lines
No EOL
802 B
Python

import requests
from config import *
class KratosApi():
@staticmethod
def get(url):
try:
return requests.get('{}{}'.format(KRATOS_URL, url))
except:
return "Failed to contact Kratos"
@staticmethod
def post(url, data):
try:
return requests.post('{}{}'.format(KRATOS_URL, url), json=data)
except:
return "Failed to contact Kratos"
@staticmethod
def put(url, data):
try:
return requests.put('{}{}'.format(KRATOS_URL, url), json=data)
except:
return "Failed to contact Kratos"
@staticmethod
def delete(url):
try:
return requests.delete('{}{}'.format(KRATOS_URL, url))
except:
return "Failed to contact Kratos"