Exemplo n.º 1
0
def handle_steam_response(response: requests.Response):
    if response.status_code == 429:
        raise TooManyRequests(
            "Steam responded with a 429 http code. Too many requests")
    elif response.status_code != 200:
        raise SteamServerError("Steam responded with a %s http code" %
                               response.status_code)
Exemplo n.º 2
0
 def fetch_price_history(self, item_hash_name: str, game: GameOptions) -> dict:
     url = SteamUrl.COMMUNITY_URL + '/market/pricehistory/'
     params = {'country': 'PL',
               'appid': game.app_id,
               'market_hash_name': item_hash_name}
     response = self._session.get(url, params=params)
     if response.status_code == 429:
         raise TooManyRequests("You can fetch maximum 20 prices in 60s period")
     return response.json()