Skip to content

Commit 0b2a1dd

Browse files
small fixes
1 parent 7daf87e commit 0b2a1dd

File tree

13 files changed

+43
-33
lines changed

13 files changed

+43
-33
lines changed

CHANGELOG.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010
[How to upgrade to the latest version!](https://unicorn-binance-websocket-api.docs.lucit.tech/readme.html#installation-and-upgrade)
1111

1212
## 2.7.0.dev (development stage/unreleased/unstable)
13+
### Changed
14+
- Improved text of `MaximumSubscriptionsExceeded` exception.
15+
- Updated description text in all files.
16+
### Fixed
17+
- Import in `licensing_manager.py`.
18+
- Type of global `logger` and `connect` variable.
1319

1420
## 2.7.0
1521
### Added
16-
- Exception `MaximumSubscriptionsExceeded` thrown by `subscribe_to_stream()`
22+
- Exception `MaximumSubscriptionsExceeded` thrown by `subscribe_to_stream()`.
1723
- `print_summary()` and `print_stream_info()` now display `binance_api_status_code` in color! Green at 200 otherwise red.
1824
### Changed
1925
- `subscribe_to_stream()` now throws the exception `MaximumSubscriptionsExceeded` instand of returning `False` if
2026
the number of allowed subscriptions per stream is exceeded.
2127
### Fixed
22-
- Typing of `create_stream()` parameters
23-
- Type of parameter `stream_label` in `get_stream_id_by_label()`
24-
- Type of first return variable in `restclient.get_listen_key()`
25-
- Typo in `is_update_availabe_unicorn_fy()` to `is_update_available_unicorn_fy()`
26-
- Typo in `is_update_availabe_check_command()` to `is_update_available_check_command()`
27-
- A couple of small text typos
28+
- Typing of `create_stream()` parameters.
29+
- Type of parameter `stream_label` in `get_stream_id_by_label()`.
30+
- Type of first return variable in `restclient.get_listen_key()`.
31+
- Typo in `is_update_availabe_unicorn_fy()` to `is_update_available_unicorn_fy()`.
32+
- Typo in `is_update_availabe_check_command()` to `is_update_available_check_command()`.
33+
- A couple of small text typos.
2834

2935
## 2.6.0
3036
### Added

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
A Python SDK by [LUCIT](https://www.lucit.tech) to use the Binance Websocket API`s (com+testnet, com-margin+testnet,
3535
com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet)
36-
in a easy, fast, flexible, robust and fully-featured way.
36+
in a simple, fast, flexible, robust and fully-featured way.
3737

3838
Part of '[UNICORN Binance Suite](https://www.lucit.tech/unicorn-binance-suite.html)'.
3939

@@ -123,8 +123,8 @@ with BinanceWebSocketApiManager(exchange='binance.com') as ubwa:
123123
asyncio.run(main())
124124
except KeyboardInterrupt:
125125
print("\r\nGracefully stopping ...")
126-
except Exception as error_msg:
127-
print(f"\r\nERROR: {error_msg}\r\nGracefully stopping ...")
126+
except Exception as e:
127+
print(f"\r\nERROR: {e}\r\nGracefully stopping ...")
128128
```
129129

130130
Basically that's it, but there are more options.

meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ about:
7575
summary: |
7676
A Python SDK by [LUCIT](https://www.lucit.tech) to use the Binance Websocket API`s (com+testnet, com-margin+testnet,
7777
com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet)
78-
in a easy, fast, flexible, robust and fully-featured way.
78+
in a simple, fast, flexible, robust and fully-featured way.
7979
description: |
8080
[![Get a UNICORN Binance Suite License](https://raw.githubusercontent.com/LUCIT-Systems-and-Development/unicorn-binance-suite/master/images/logo/LUCIT-UBS-License-Offer.png)](https://shop.lucit.services)
8181
[![GitHub Release](https://img.shields.io/github/release/LUCIT-Systems-and-Development/unicorn-binance-websocket-api.svg?label=github)](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/releases)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "unicorn-binance-websocket-api"
33
version = "2.7.0"
4-
description = "A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a easy, fast, flexible, robust and fully-featured way."
4+
description = "A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way."
55
authors = ["LUCIT Systems and Development <[email protected]>"]
66
license = "LSOSL - LUCIT Synergetic Open Source License"
77
readme = "README.md"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
url="https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api",
6363
description="A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, "
6464
"com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, "
65-
"dex/chain+testnet) in a easy, fast, flexible, robust and fully-featured way.",
65+
"dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.",
6666
long_description=long_description,
6767
long_description_content_type="text/markdown",
6868
license='LSOSL - LUCIT Synergetic Open Source License',

unicorn_binance_websocket_api/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import threading
3030

3131

32-
logger = logging.getLogger("unicorn_binance_websocket_api")
32+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
3333

3434

3535
class BinanceWebSocketApiApi(object):

unicorn_binance_websocket_api/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import sys
2828
import websockets
2929

30-
connect = websockets.connect
31-
logger = logging.getLogger("unicorn_binance_websocket_api")
30+
connect: websockets.connect = websockets.connect
31+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
3232

3333

3434
class BinanceWebSocketApiConnection(object):

unicorn_binance_websocket_api/exceptions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020

2121
class MaximumSubscriptionsExceeded(Exception):
2222
"""
23-
Exception if the maximum number of subscriptions has been exceeded!
23+
Exception if the maximum number of subscriptions per stream has been exceeded!
2424
"""
25-
def __init__(self, max_subscriptions=None):
26-
self.message = f"The maximum number of {max_subscriptions} subscriptions per stream has been exceeded!"
25+
def __init__(self, exchange: str = None, max_subscriptions_per_stream: int = None):
26+
self.message = (f"The maximum number of {max_subscriptions_per_stream} subscriptions per stream for exchange "
27+
f"'{exchange}' has been exceeded! For detailed information please have a look at our wiki: "
28+
f"https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/wiki/Binance-"
29+
f"websocket-endpoint-configuration-overview")
2730
super().__init__(self.message)
2831

2932

unicorn_binance_websocket_api/licensing_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
from simplejson.errors import JSONDecodeError
3636
from typing import Optional, Callable
3737
try:
38-
from licensing_exceptions import NoValidatedLucitLicense
38+
from .licensing_exceptions import NoValidatedLucitLicense
3939
except ModuleNotFoundError:
4040
from unicorn_binance_websocket_api.licensing_exceptions import NoValidatedLucitLicense
4141

42-
logger = logging.getLogger("lucit_licensing_python")
42+
logger: logging.getLogger = logging.getLogger("lucit_licensing_python")
4343

4444

4545
class LucitLicensingManager(threading.Thread):

unicorn_binance_websocket_api/manager.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@
6363
__app_name__: str = "unicorn-binance-websocket-api"
6464
__version__: str = "2.7.0.dev"
6565

66-
logger = logging.getLogger("unicorn_binance_websocket_api")
66+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
6767

6868

6969
class BinanceWebSocketApiManager(threading.Thread):
7070
"""
71-
An unofficial Python API to use the Binance Websocket API`s (com+testnet, com-margin+testnet,
72-
com-isolated_margin+testnet, com-futures+testnet, us, dex/chain+testnet) in an easy, fast, flexible,
73-
robust and fully-featured way.
71+
A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet,
72+
com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast,
73+
flexible, robust and fully-featured way.
7474
7575
This library supports two different kind of websocket endpoints:
7676
@@ -4632,12 +4632,13 @@ def subscribe_to_stream(self, stream_id: str = None, channels=None, markets=None
46324632
if self.stream_list[stream_id]['subscriptions'] > self.max_subscriptions_per_stream:
46334633
error_msg = (f"The limit of {str(self.max_subscriptions_per_stream)} subscriptions per stream has been "
46344634
f"exceeded!")
4635-
logger.error(f"BinanceWebSocketApiManager.subscribe_to_stream({str(stream_id)}) - error_msg: {str(error_msg)}")
4636-
# self._crash_stream(stream_id, error_msg=error_msg)
4637-
#return False
4638-
raise MaximumSubscriptionsExceeded(max_subscriptions=str(self.max_subscriptions_per_stream))
4635+
logger.error(f"BinanceWebSocketApiManager.subscribe_to_stream({str(stream_id)}) - error_msg: "
4636+
f"{str(error_msg)}")
4637+
raise MaximumSubscriptionsExceeded(exchange=self.get_exchange(),
4638+
max_subscriptions_per_stream=self.max_subscriptions_per_stream)
46394639
if payload is None:
4640-
logger.error(f"BinanceWebSocketApiManager.subscribe_to_stream({str(stream_id)}) - error_msg: Payload is None!")
4640+
logger.error(f"BinanceWebSocketApiManager.subscribe_to_stream({str(stream_id)}) - error_msg: Payload is "
4641+
f"None!")
46414642
return False
46424643
try:
46434644
for item in payload:

unicorn_binance_websocket_api/restclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import threading
2626
import time
2727

28-
logger = logging.getLogger("unicorn_binance_websocket_api")
28+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
2929

3030

3131
class BinanceWebSocketApiRestclient(object):

unicorn_binance_websocket_api/restserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from flask_restful import Resource
2222
import logging
2323

24-
logger = logging.getLogger("unicorn_binance_websocket_api")
24+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
2525

2626

2727
class BinanceWebSocketApiRestServer(Resource):

unicorn_binance_websocket_api/sockets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import ujson as json
2727
import logging
2828

29-
logger = logging.getLogger("unicorn_binance_websocket_api")
29+
logger: logging.getLogger = logging.getLogger("unicorn_binance_websocket_api")
3030

3131

3232
class BinanceWebSocketApiSocket(object):

0 commit comments

Comments
 (0)