Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions Book Library/app/models/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@

class Books():
def __init__(self, query="", start=0, testing=False, https=False):
if not testing:
self.json = google_book_search(query, start)
else:
self.json = testing

self.https = True if https else False
self.json = google_book_search(query, start) if not testing else testing
self.https = bool(https)

def parse(self):
"""
Expand Down Expand Up @@ -56,12 +52,11 @@ def _parse_thumbnail(self, imageLinks=""):
"""
if not imageLinks:
return {"thumbnail": "static/images/booky-book.jpg"}
else:
if self.https:
for link in imageLinks:
imageLinks[link] = convert_to_https(imageLinks[link])
if self.https:
for link in imageLinks:
imageLinks[link] = convert_to_https(imageLinks[link])

return imageLinks
return imageLinks


def payload(items, total):
Expand Down