feat(Users): Implemented Kratos CRUD
This commit is contained in:
parent
a208b5f441
commit
a81d14b4f8
10 changed files with 99 additions and 48 deletions
32
helpers/kratos_api.py
Normal file
32
helpers/kratos_api.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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"
|
||||
Reference in a new issue