
2-9에서
app.py에 아래 코드를 넣고 페이지에서 메인페이지에서 영어 단어를 눌렀는데, 상세페이지로 넘어가지않고 파이몽고 오류만 뜹니다.
@app.route('/detail/<keyword>')
def detail(keyword):
print(keyword)
r = requests.get(f"https://owlbot.info/api/v4/dictionary/{keyword}", headers={"Authorization": "Token 3300b9800ea26dfc177a9e267c65ff96c995238a"})
result = r.json()
print(result)
db_word = db.words.find_one({'word':keyword}, {"_id": False})
print(db_word)
word_name = keyword # 단어이름
result = result # open api 응답값
is_saved = False # 저장 유무
examples = [] # 예문
if db_word:
is_saved=True
# 단어의 예문도 찾아서 같이 보내줍니다.
pass
return render_template("detail.html", word_name=word_name, result=result, is_saved=is_saved, examples=examples)
pymongo.errors.OperationFailure: Authentication failed., full error: {'ok': 0.0, 'errmsg': 'Authentication failed.', 'code': 18, 'codeName': 'AuthenticationFailed'}
