예제 #1
0
파일: book.py 프로젝트: JX-T/flask-fisher
 def __init__(self, data):
     self.title = data['title']
     self.author = '、'.join(data['author'])
     self.binding = data['binding']
     self.publisher = data['publisher']
     self.image = data['image']
     self.price = '¥' + data['price'] if data['price'] else data['price']
     self.isbn = get_isbn(data)
     self.pubdate = data['pubdate']
     self.summary = data['summary']
     self.pages = data['pages']
예제 #2
0
    def persistence_yushu(cls, book):
        book_model = Book()
        book_model.set_attrs(book)

        # book_model.isbn = book['isbn13'] or book['isbn10']
        book_model.isbn = get_isbn(book)
        book_model.image = book['images']['large']
        # book_model.origin_url = book['url']
        # book_model.score = book['rating']['average']
        # book_model.tags = book['tags']
        db.session.add(book_model)
        db.session.commit()
        return book_model
예제 #3
0
 def __init__(self, data):
     # if not isinstance(data, dict):V
     #     author = data.author
     #     data = data.__dict__
     #     data['author'] = author
     self.title = data['title']
     self.author = '、'.join(data['author'])
     self.binding = data['binding']
     self.publisher = data['publisher']
     self.image = data['image']
     self.price = '¥' + data['price'] if data['price'] else data['price']
     self.isbn = get_isbn(data)
     self.pubdate = data['pubdate']
     self.summary = data['summary']
     self.pages = data['pages']