In the code below, you have a GET endpoint for getting a book by the id, all needed imports and application instance are handled behind the scenes.
Your task is to fill out blank lines on the returning statements to complete REST API logic
Designing REST API
Adding responses
Report a typo
Write a program in Python 3
@app.route("/books/<book_id>", methods=["PUT"])
def get_book(book_id: int, ):
book_data = internal_database_request(book_id)
if not book_data:
# Fill out missing part
return ...
# Fill out missing part
return ...
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.