Data
This commit is contained in:
parent
8482aafcfa
commit
7f80451aab
8 changed files with 72 additions and 1 deletions
23
API/main.py
Normal file
23
API/main.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import configparser
|
||||
import fastapi
|
||||
from fastapi import HTTPException
|
||||
import utils
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('../configs/settings.conf', encoding='utf-8')
|
||||
path = config['database']['path']
|
||||
|
||||
DB = utils.DataBase(path=path)
|
||||
|
||||
app = fastapi.FastAPI()
|
||||
|
||||
@app.post("/web/registration/")
|
||||
def reg(email: str, passwd: str) :
|
||||
code = DB.register_site(email, passwd)
|
||||
if code == 0 :
|
||||
return 200
|
||||
else :
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="Этот email уже зарегистрирован"
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue