我正在观看快车道学课程,该课程将数据库从凯科特转换为PogreSQL,然后产生一个信号。 它以前曾工作过,但现在有错误,如下所示:
return bcode.checkpw (password=password_byte_enc, hashed_password=hashed_password) 类型 错误:标语为“密码”的论点不能改为PyBytes
。
我认为,这是关于错误的法典:
def get_password_hash(password):
# return bcrypt_context.hash(password)
pwd_bytes = password.encode( utf-8 )
salt = bcrypt.gensalt()
hashed_password = bcrypt.hashpw(password=pwd_bytes, salt=salt)
return hashed_password
def verify_password(plain_password, hashed_password):
password_byte_enc = plain_password.encode( utf-8 )
return bcrypt.checkpw(password=password_byte_enc, hashed_password=hashed_password)
The entirity of the auth.py file is here
This is where I input the username and password to generate a token but it gets an error: