From 134c94192880f3bb89de99c81cd8f5ec4ae74ab2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 12 May 2024 11:46:53 +0200 Subject: [PATCH] UnicornFy.get_version() --- CHANGELOG.md | 2 ++ unicorn_fy/unicorn_fy.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 179d757..3d9f402 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-fy.docs.lucit.tech/readme.html#installation-and-upgrade) ## 0.14.2.dev (development stage/unreleased/unstable) +### Added +- `__version__` and made use of it. ### Removed - `binance_je_websocket()` - `jex_com_websocket()` diff --git a/unicorn_fy/unicorn_fy.py b/unicorn_fy/unicorn_fy.py index f750aa7..d2e464d 100755 --- a/unicorn_fy/unicorn_fy.py +++ b/unicorn_fy/unicorn_fy.py @@ -273,12 +273,12 @@ def binance_websocket(stream_data_json, exchange="binance", show_deprecated_warn try: if stream_data['result'] is None: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_websocket({str(stream_data)}, {str(exchange)}") return stream_data else: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_websocket({str(stream_data)}, {str(exchange)}") return stream_data @@ -287,7 +287,7 @@ def binance_websocket(stream_data_json, exchange="binance", show_deprecated_warn try: if stream_data['error']: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_websocket({str(stream_data)}, {str(exchange)}") return stream_data @@ -558,7 +558,7 @@ def binance_websocket(stream_data_json, exchange="binance", show_deprecated_warn 'order_creation_time': stream_data['data']['O'], 'cumulative_quote_asset_transacted_quantity': stream_data['data']['Z'], 'last_quote_asset_transacted_quantity': stream_data['data']['Y']} - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] unicorn_fied_data['unicorn_fied'] = unicorn_fied_version logger.debug("UnicornFy->binance_com_futures_websocket(" + str(unicorn_fied_data) + ")") return unicorn_fied_data @@ -644,12 +644,12 @@ def binance_futures_websocket(stream_data_json, exchange="binance.com-futures", try: if stream_data['result'] is None: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_futures_websocket({str(stream_data)}, {str(exchange)}") return stream_data else: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_futures_websocket({str(stream_data)}, {str(exchange)}") return stream_data @@ -658,7 +658,7 @@ def binance_futures_websocket(stream_data_json, exchange="binance.com-futures", try: if stream_data['error']: - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] stream_data['unicorn_fied'] = unicorn_fied_version logger.debug(f"UnicornFy->binance_futures_websocket({str(stream_data)}, {str(exchange)}") return stream_data @@ -1243,7 +1243,7 @@ def binance_futures_websocket(stream_data_json, exchange="binance.com-futures", except KeyError as error_msg: logger.critical(f"UnicornFy->binance_futures_websocket({str(unicorn_fied_data)}) - " f"error: {str(error_msg)} - Variable: {stream_data['data']}") - unicorn_fied_version = [exchange, UnicornFy.VERSION] + unicorn_fied_version = [exchange, UnicornFy.get_version()] try: unicorn_fied_data['unicorn_fied'] = unicorn_fied_version except TypeError as error_msg: @@ -1290,7 +1290,7 @@ def get_version(): :return: str """ - return UnicornFy.VERSION + return __version__ @staticmethod def is_json(data):