Beispiel #1
0
 def search_by_isbn(self, isbn):
     # self.param 查找:实例变量 -> 类变量
     url = self.isbn_url.format(isbn)
     result = HTTP.get(url)
     print(result)
     self.__fill_single(result)
     # TODO: save to database
     return result
Beispiel #2
0
 def search_by_isbns(self, wish_isbns, gift_count):
     # 将我想赠送但无人想要的书籍添加进 gifts 中并将 count 赋值为 0
     for isbn in wish_isbns:
         result = HTTP.get(YuShuBook.isbn_url.format(isbn))
         count = 0
         for gift in gift_count:
             if isbn in gift.values():
                 count = gift["count"]
                 break
         self.__fill_single(result, count)
     return sorted(self.wishs,
                   key=lambda x: x["wishes_count"],
                   reverse=True)
Beispiel #3
0
 def search_by_keyword(self, keyword, page=1):
     result = HTTP.get(
         self.keyword_url.format(keyword, current_app.config["PER_PAGE"],
                                 self.calculate_page(page)))
     self.__fill__collection(result)
     self.keyword = keyword
Beispiel #4
0
 def search_by_isbn(self, keyword):
     result = HTTP.get(self.isbn_url.format(keyword))
     self.__fill_single(result)
     self.keyword = keyword
Beispiel #5
0
 def serch_by_keyword(self, keyword, page=1):
     url = self.keyword_url.format(keyword, current_app.config['PER_PAGE'],
                                   self.calculate_start(page))
     result = HTTP.get(url)
     self.__fill_collection(result)
Beispiel #6
0
 def serch_by_isbn(self, isbn):
     url = self.isbn_url.format(isbn)
     result = HTTP.get(url)
     self.__fill_single(result)