dashboard/helpers/kratos_api.py

32 lines
802 B
Python
Raw Normal View History

2021-10-28 16:09:10 +02:00
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"