Skip to content

Commit 2b9d315

Browse files
committed
Random cleanup
1 parent 90ebe02 commit 2b9d315

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

cryptofeed/connection.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from aiohttp.client_reqrep import ClientResponse
1818
import requests
19-
from websockets.asyncio.client import connect
19+
from websockets.asyncio.client import connect, ClientConnection
2020
from websockets.protocol import State
2121
import aiohttp
2222
from aiohttp.typedefs import StrOrURL
@@ -82,7 +82,7 @@ def __init__(self, conn_id: str, authentication=None, subscription=None):
8282
self.last_message = None
8383
self.authentication = authentication
8484
self.subscription = subscription
85-
self.conn: Union[websockets.WebSocketClientProtocol, aiohttp.ClientSession] = None
85+
self.conn: Union[ClientConnection, aiohttp.ClientSession] = None
8686
atexit.register(self.__del__)
8787

8888
def __del__(self):

cryptofeed/connection_handler.py

-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
'''
77
import asyncio
88
import logging
9-
import random
109
from socket import error as socket_error
1110
import time
1211
from typing import Awaitable
@@ -51,7 +50,6 @@ async def _watcher(self):
5150
async def _create_connection(self):
5251
await asyncio.sleep(self.start_delay)
5352
retries = 0
54-
rate_limited = 1
5553
delay = 1
5654
while (retries <= self.retries or self.retries == -1) and self.running:
5755
try:
@@ -60,7 +58,6 @@ async def _create_connection(self):
6058
await self.subscribe(connection)
6159
# connection was successful, reset retry count and delay
6260
retries = 0
63-
rate_limited = 0
6461
delay = 1
6562
if self.timeout != -1:
6663
loop = asyncio.get_running_loop()

cryptofeed/exchanges/kucoin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ async def subscribe(self, conn: AsyncConnection):
285285
await conn.write(json.dumps({
286286
'id': 1,
287287
'type': 'subscribe',
288-
'topic': f"{chan}:{','.join(symbols[slice_index: slice_index+100])}",
288+
'topic': f"{chan}: {','.join(symbols[slice_index: slice_index + 100])}",
289289
'privateChannel': False,
290290
'response': True
291291
}))

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ order_book==0.6.1
77
pyyaml
88
requests>=2.18.4
99
uvloop
10-
websockets>=7.0
10+
websockets>=14.1
1111
yapic.json>=1.6.3

tools/websockets_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ async def main():
3232
if not is_gzip:
3333
print(f"< {response}")
3434
else:
35-
print(f"< {zlib.decompress(response, 16+zlib.MAX_WBITS)}")
35+
print(f"< {zlib.decompress(response, 16 + zlib.MAX_WBITS)}")
3636

3737
asyncio.get_event_loop().run_until_complete(main())

0 commit comments

Comments
 (0)