diff --git a/Book.py b/Book.py index 7721d40..d54aa8c 100644 --- a/Book.py +++ b/Book.py @@ -1,18 +1,20 @@ class Book: - def __init__(self, name: str, description: str, image: str, review: str, release_date: str, reading_date: str) -> None: + def __init__(self, name: str, author: str, description: str, image: str, review: str, release_date: str, reading_date: str) -> None: self.name: str = name self.description: str = description self.image: str = image self.review: str = review self.release_date: str = release_date self.reading_date: str = reading_date + self.author: str = author def to_html(self) -> str: return f"""
{self.name}
{self.description}
{self.release_date}
diff --git a/constructor_example.json b/constructor_example.json index 4759e22..fb285b4 100644 --- a/constructor_example.json +++ b/constructor_example.json @@ -2,6 +2,7 @@ "books": [ { "name": "1984", + "author": "George Orwell" "description": "1984 est un roman dystopique de l'écrivain britannique George Orwell. Publié le 8 juin 1949 par Secker & Warburg, il s'agit du neuvième et dernier livre d'Orwell achevé de son vivant", "image": "1984.jpg", "review": "ct pas mal", diff --git a/main.py b/main.py index aa53422..bfadd32 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,7 @@ books = data['books'] html = "" for book_data in books: - book = Book(book_data["name"], book_data["description"], book_data["image"], book_data["review"], book_data["release_date"], book_data["reading_date"]) + book = Book(book_data["name"], book_data["author"], book_data["description"], book_data["image"], book_data["review"], book_data["release_date"], book_data["reading_date"]) html += book.to_html() f = open("cast.html")