def search_by_isbn(self, isbn): """ isbn搜索的结果可以被缓存 """ url = self.isbn_url.format(isbn) result = Http.get(url) self.__fill_single(result)
def search_by_keyword(self, keyword, page): """ keyword不缓存,意义不大 """ page = int(page) url = self.keyword_url.format(keyword, self.per_page, self.per_page * (page - 1)) result = Http.get(url) self.__fill_collection(result)
def getLocation(self,Latlng): url=self.url1.format(Latlng) result=Http.get(url) self._fill(result) url1=self.url2.format(Latlng) result1=Http.getPicture(url1) self._fill(result) self.view=result1
def get_openid(self, code): url = self.url.format(current_app.config['APP_ID'], current_app.config['SECRET'], code) # print(url) result = Http.get(url) print(result) try: self.fill(result) except KeyError: print("Invalid response form WeChat Server")
def get_book_from_api(cls, isbn, persistence=False): url = cls.isbn_url.format(isbn) # result = Http(url).get() result = Http(url).get() if result.get('code') == 2000: return {}, 'from_api' if persistence: book_model = MySQL.persistence_douban(result) return book_model, 'from_mysql' return result, 'from_api'
def search_by_query(cls, query): url = cls.url.format(query) result = Http.get(url) return result
def search_by_keyword(cls, keyword, page=1): url = cls.keyword_url.format(keyword, current_app.config['PER_PAGE'], cls.calculate_start(page)) result = Http.get(url) return result
def search_by_isbn(cls, isbn): url = cls.isbn_url.format(isbn) result = Http.get(url) return result
def search_by_keyword(self, keyword, page): page = int(page) url = self.keyword_url.format(keyword, self.per_page, self.per_page * (page - 1)) result = Http.get(url) self._fill_connection(result)
def search_by_isbn(self, isbn): url = self.isbn_url.format(isbn) result = Http.get(url) self.__fill_single(result)