Example #1
0
 def get_wallet_balance(self,
                        convert_to_float: bool = True) -> Union[str, float]:
     url = SteamUrl.STORE_URL + '/account/history/'
     response = self._session.get(url)
     response_soup = bs4.BeautifulSoup(response.text, "html.parser")
     balance = response_soup.find(id='header_wallet_balance').string
     if convert_to_float:
         return price_to_float(balance)
     else:
         return balance
Example #2
0
 def test_price_to_float(self):
     price = '$11.33 USD'
     float_price = utils.price_to_float(price)
     self.assertEquals(float_price, 11.33)
Example #3
0
 def test_price_to_float_without_space(self):
     price = '21,37zł'
     float_price = utils.price_to_float(price)
     self.assertEquals(float_price, 21.37)
Example #4
0
 def test_price_to_float_without_decimal_separator(self):
     price = '2137 CZK'
     float_price = utils.price_to_float(price)
     self.assertEquals(float_price, 2137)
Example #5
0
 def test_price_to_float_without_currency_symbol(self):
     price = '11,33 USD'
     float_price = utils.price_to_float(price)
     self.assertEquals(float_price, 11.33)