From 6c1f9bb1f5e36e3eb3629143d5d62c0f602c2020 Mon Sep 17 00:00:00 2001 From: Georg Sauthoff Date: Sat, 23 Jan 2021 16:38:10 +0100 Subject: [PATCH] Avoid rounding issues with float --- inema/inema.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inema/inema.py b/inema/inema.py index c19abcd..4b96725 100644 --- a/inema/inema.py +++ b/inema/inema.py @@ -13,6 +13,7 @@ import pkg_resources import requests, zipfile import io import logging +import decimal __version__ = pkg_resources.get_distribution(__package__).version @@ -93,8 +94,8 @@ class Internetmarke(object): return [p, t, k, s] def get_product_price_by_id(self, ext_prod_id): - price_float_str = marke_products[str(ext_prod_id)]['cost_price'] - return int(round(float(price_float_str) * 100)) + price_str = marke_products[str(ext_prod_id)]['cost_price'] + return int(decimal.Decimal(price_str) * 100) def __init__(self, partner_id, key, key_phase="1"): self.client = Client(self.wsdl_url)