diff --git a/CHANGELOG.md b/CHANGELOG.md index 9330e96..f006237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p [How to upgrade to the latest version!](https://unicorn-binance-rest-api.docs.lucit.tech/readme.html#installation-and-upgrade) ## 2.5.1.dev (development stage/unreleased/unstable) +### Fixed +- `_save_used_weight()` - Exception: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' ## 2.5.1 ### Changed diff --git a/unicorn_binance_rest_api/manager.py b/unicorn_binance_rest_api/manager.py index f2b089f..306ecdd 100644 --- a/unicorn_binance_rest_api/manager.py +++ b/unicorn_binance_rest_api/manager.py @@ -607,12 +607,15 @@ def _request_futures_coin_data_api(self, method, path, signed=False, version=1, def _save_used_weight(self) -> bool: try: + weight = self.response.headers.get('X-MBX-USED-WEIGHT') + if weight is None: + return False self.used_weight = {'status_code': int(self.response.status_code), 'timestamp': datetime.datetime.strptime(self.response.headers.get('Date'), "%a, %d %b %Y %H:%M:%S GMT").timestamp(), - 'weight': int(self.response.headers.get('X-MBX-USED-WEIGHT'))} + 'weight': int(weight)} except Exception as error_msg: - logger.debug(f"BinanceRestApiManager.stop_manager() - Exception: {error_msg}") + logger.debug(f"BinanceRestApiManager._save_used_weight() - Exception: {error_msg}") return False return True @@ -7225,8 +7228,7 @@ def stop_manager(self, close_api_session=True): """ Stop the BinanceRestApiManager """ - logger.info("BinanceRestApiManager.stop_manager() - Stopping " - "unicorn_binance_rest_api_manager " + self.version + " ...") + logger.info(f"BinanceRestApiManager.stop_manager() - Stopping ...") self.sigterm = True # close the request session try: