语法错误当我尝试 运行 后端代码时
Syntax error When I try to run backend code
当我尝试 运行 服务器时出现语法错误。但是没有任何错误的语法使用。请帮忙解决这个问题! Issue image
from blacksheep.server.application import Application
from blacksheep.server.controllers import Controller, get, post
from blacksheep.cookies import Cookie
from blacksheep.messages import Response
from easy_cryptography.hash.hash_funct import compare_hash
from app.configuration import AUTHORIZED
from models import Doctors
from pony.orm import *
class Home(Controller):
@get("/")
def index(self):
return self.view()
class Patients(Controller):
@post("/patients")
def patients(self, login: str, password: str):
if Doctors.exists(login) and (compare_hash(password, Doctors.get_for_update(login = login).password)):
patients = Patients.select()
response = self.view(patients=patients)
response.set_cookie(Cookie(AUTHORIZED,True))
return response
else:
return "{'message':'Неверный логин или пароль'}"
您似乎在 def index(self):
之前缺少 async
关键字
我看到的另一个错误是您没有从 @post
装饰器将参数正确绑定到 patients
方法。
当我尝试 运行 服务器时出现语法错误。但是没有任何错误的语法使用。请帮忙解决这个问题! Issue image
from blacksheep.server.application import Application
from blacksheep.server.controllers import Controller, get, post
from blacksheep.cookies import Cookie
from blacksheep.messages import Response
from easy_cryptography.hash.hash_funct import compare_hash
from app.configuration import AUTHORIZED
from models import Doctors
from pony.orm import *
class Home(Controller):
@get("/")
def index(self):
return self.view()
class Patients(Controller):
@post("/patients")
def patients(self, login: str, password: str):
if Doctors.exists(login) and (compare_hash(password, Doctors.get_for_update(login = login).password)):
patients = Patients.select()
response = self.view(patients=patients)
response.set_cookie(Cookie(AUTHORIZED,True))
return response
else:
return "{'message':'Неверный логин или пароль'}"
您似乎在 def index(self):
async
关键字
我看到的另一个错误是您没有从 @post
装饰器将参数正确绑定到 patients
方法。