async def fetch_current_auctions(self, page=1, filters=None): """Fetches the current auctions in the bazaar .. versionadded:: 3.3.0 Parameters ---------- page: :class:`int` The desired page to display. filters: :class:`AuctionFilters` The filtering criteria to use. Returns ------- :class:`TibiaResponse` of :class:`CharacterBazaar` The current auctions. Raises ------ Forbidden If a 403 Forbidden error was returned. This usually means that Tibia.com is rate-limiting the client because of too many requests. NetworkError If there's any connection errors during the request. ValueError If the page number is not 1 or greater. """ if not page: raise ValueError('page must be 1 or greater.') response = await self._request( "GET", CharacterBazaar.get_current_auctions_url(page, filters)) start_time = time.perf_counter() current_auctions = CharacterBazaar.from_content(response.content) parsing_time = time.perf_counter() - start_time return TibiaResponse(response, current_auctions, parsing_time)
async def test_client_fetch_current_auctions(self, mock): """Testing fetching the current auctions""" content = self.load_resource(FILE_BAZAAR_CURRENT) mock.get(CharacterBazaar.get_current_auctions_url(), status=200, body=content) response = await self.client.fetch_current_auctions() self.assertIsInstance(response.data, CharacterBazaar)