parent
fc65326370
commit
55ac551a2a
@ -31,11 +31,15 @@ class SocketReader(object):
|
|||||||
buffer = b""
|
buffer = b""
|
||||||
|
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as socket_handle:
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as socket_handle:
|
||||||
|
socket_handle.settimeout(60)
|
||||||
socket_handle.connect((self.host, self.port))
|
socket_handle.connect((self.host, self.port))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
buffer += socket_handle.recv(self.BUFFER_SIZE)
|
try:
|
||||||
|
buffer += socket_handle.recv(self.BUFFER_SIZE)
|
||||||
|
except socket.timeout:
|
||||||
|
logger.error("Socket timeout occurred, exiting")
|
||||||
|
break
|
||||||
|
|
||||||
lines = buffer.splitlines(keepends=True)
|
lines = buffer.splitlines(keepends=True)
|
||||||
|
|
||||||
|
5
tox.ini
5
tox.ini
@ -14,6 +14,9 @@ commands=
|
|||||||
[pylama:dsmr_parser/clients/__init__.py]
|
[pylama:dsmr_parser/clients/__init__.py]
|
||||||
ignore = W0611
|
ignore = W0611
|
||||||
|
|
||||||
|
[pylama:dsmr_parser/clients/socket_.py]
|
||||||
|
ignore = C901
|
||||||
|
|
||||||
[pylama:dsmr_parser/parsers.py]
|
[pylama:dsmr_parser/parsers.py]
|
||||||
ignore = W605
|
ignore = W605
|
||||||
|
|
||||||
@ -24,4 +27,4 @@ ignore = E501
|
|||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
|
|
||||||
[pylama:pycodestyle]
|
[pylama:pycodestyle]
|
||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
|
Loading…
Reference in New Issue
Block a user