Print running dataset count after each received record in client.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ def main() -> None:
|
|||||||
|
|
||||||
print("Connected. Waiting for data (Ctrl-C to quit).\n", flush=True)
|
print("Connected. Waiting for data (Ctrl-C to quit).\n", flush=True)
|
||||||
buf = ""
|
buf = ""
|
||||||
|
count = 0
|
||||||
try:
|
try:
|
||||||
with sock:
|
with sock:
|
||||||
while True:
|
while True:
|
||||||
@@ -50,8 +51,9 @@ def main() -> None:
|
|||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
data = json.loads(line)
|
data = json.loads(line)
|
||||||
|
count += 1
|
||||||
print(json.dumps(data, indent=2))
|
print(json.dumps(data, indent=2))
|
||||||
print("-" * 60, flush=True)
|
print(f"--- #{count} ", "-" * 50, flush=True)
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
print(f"[invalid JSON] {e}: {line!r}", file=sys.stderr)
|
print(f"[invalid JSON] {e}: {line!r}", file=sys.stderr)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user