Skip to content

Commit

Permalink
- Exception: int() argument must be a string, a bytes-like object or …
Browse files Browse the repository at this point in the history
…a real number, not 'NoneType'
  • Loading branch information
oliver-zehentleitner committed May 15, 2024
1 parent dae0d1b commit 835935a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions unicorn_binance_rest_api/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 835935a

Please sign in to comment.