Skip to content

Commit 057b2b7

Browse files
committed
Обновил версию до 1.2.6 и оптимизировал импорты в SocketMixin
1 parent e5333b4 commit 057b2b7

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "maxapi-python"
3-
version = "1.2.5"
3+
version = "1.2.6"
44
description = "Python wrapper для API мессенджера Max"
55
readme = "README.md"
66
requires-python = ">=3.10"

src/pymax/mixins/socket.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import socket
55
import ssl
66
import sys
7-
import time
8-
import traceback
9-
from collections.abc import Callable
10-
from typing import Any, Literal
7+
from typing import Any
118
from urllib.parse import urlparse
129

1310
import lz4.block
@@ -17,31 +14,22 @@
1714
from pymax.exceptions import Error, SocketNotConnectedError, SocketSendError
1815
from pymax.filters import BaseFilter
1916
from pymax.interfaces import BaseTransport
20-
from pymax.payloads import BaseWebSocketMessage, SyncPayload, UserAgentPayload
21-
from pymax.protocols import ClientProtocol
17+
from pymax.payloads import UserAgentPayload
2218
from pymax.static.constant import (
23-
DEFAULT_PING_INTERVAL,
2419
DEFAULT_TIMEOUT,
2520
RECV_LOOP_BACKOFF_DELAY,
2621
)
27-
from pymax.static.enum import ChatType, MessageStatus, Opcode
22+
from pymax.static.enum import Opcode
2823
from pymax.types import (
29-
Channel,
3024
Chat,
31-
Dialog,
32-
Me,
33-
Message,
34-
ReactionCounter,
35-
ReactionInfo,
36-
User,
3725
)
3826

3927

4028
class SocketMixin(BaseTransport):
4129
def _close_socket_safely(self) -> None:
4230
if self._socket is not None:
4331
sock = self._socket
44-
self._socket = None # Nullify reference first to prevent double-closes
32+
self._socket = None
4533
with contextlib.suppress(ssl.SSLError, Exception):
4634
sock.close()
4735

@@ -365,13 +353,15 @@ async def _recv_loop(self) -> None:
365353

366354
while True:
367355
try:
368-
sock = self._socket # Get fresh reference on each iteration
356+
sock = self._socket
369357
if sock is None:
370358
self.logger.warning("Socket became None, exiting recv loop")
371359
break
372360

373361
header = await self._parse_header(loop, sock)
374362

363+
self.logger.debug("Received header: %s", header)
364+
375365
if not header:
376366
break
377367

0 commit comments

Comments
 (0)