chzzk-python 0.9.3__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.env.example +8 -0
  2. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/PKG-INFO +67 -2
  3. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/README.md +65 -1
  4. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/README_KO.md +65 -1
  5. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/.env.example +8 -0
  6. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/pyproject.toml +2 -0
  7. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/_version.py +2 -2
  8. chzzk_python-0.11.0/src/chzzk/cli/commands/auth.py +586 -0
  9. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/commands/chat.py +48 -2
  10. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/chat/client.py +23 -5
  11. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/chat/monitor.py +87 -2
  12. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/client.py +52 -4
  13. chzzk_python-0.11.0/tests/unofficial/__init__.py +1 -0
  14. chzzk_python-0.11.0/tests/unofficial/test_client.py +250 -0
  15. chzzk_python-0.11.0/tests/unofficial/test_monitor.py +455 -0
  16. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/uv.lock +26 -0
  17. chzzk_python-0.9.3/src/chzzk/cli/commands/auth.py +0 -171
  18. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.github/workflows/build.yml +0 -0
  19. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.github/workflows/ci.yml +0 -0
  20. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.github/workflows/publish.yml +0 -0
  21. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.gitignore +0 -0
  22. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/.python-version +0 -0
  23. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/LICENSE +0 -0
  24. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/chzzk.spec +0 -0
  25. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/docs/unofficial-chat-websocket-protocol.md +0 -0
  26. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/oauth_server.py +0 -0
  27. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/realtime_chat.py +0 -0
  28. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/realtime_chat_async.py +0 -0
  29. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/session_management.py +0 -0
  30. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/unofficial_chat.py +0 -0
  31. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/examples/unofficial_chat_async.py +0 -0
  32. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/main.py +0 -0
  33. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/scripts/build.py +0 -0
  34. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/__init__.py +0 -0
  35. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/__init__.py +0 -0
  36. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/base.py +0 -0
  37. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/category.py +0 -0
  38. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/channel.py +0 -0
  39. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/chat.py +0 -0
  40. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/live.py +0 -0
  41. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/restriction.py +0 -0
  42. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/session.py +0 -0
  43. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/api/user.py +0 -0
  44. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/auth/__init__.py +0 -0
  45. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/auth/models.py +0 -0
  46. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/auth/oauth.py +0 -0
  47. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/auth/token.py +0 -0
  48. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/__init__.py +0 -0
  49. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/commands/__init__.py +0 -0
  50. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/commands/live.py +0 -0
  51. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/config.py +0 -0
  52. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/formatter.py +0 -0
  53. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/logging.py +0 -0
  54. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/main.py +0 -0
  55. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/cli/writers.py +0 -0
  56. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/client.py +0 -0
  57. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/constants.py +0 -0
  58. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/exceptions/__init__.py +0 -0
  59. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/exceptions/errors.py +0 -0
  60. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/http/__init__.py +0 -0
  61. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/http/_base.py +0 -0
  62. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/http/client.py +0 -0
  63. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/http/endpoints.py +0 -0
  64. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/logging.py +0 -0
  65. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/__init__.py +0 -0
  66. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/category.py +0 -0
  67. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/channel.py +0 -0
  68. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/chat.py +0 -0
  69. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/common.py +0 -0
  70. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/live.py +0 -0
  71. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/restriction.py +0 -0
  72. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/session.py +0 -0
  73. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/models/user.py +0 -0
  74. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/py.typed +0 -0
  75. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/realtime/__init__.py +0 -0
  76. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/realtime/client.py +0 -0
  77. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/__init__.py +0 -0
  78. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/api/__init__.py +0 -0
  79. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/api/base.py +0 -0
  80. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/api/chat.py +0 -0
  81. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/api/live.py +0 -0
  82. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/api/user.py +0 -0
  83. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/auth/__init__.py +0 -0
  84. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/auth/cookie.py +0 -0
  85. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/chat/__init__.py +0 -0
  86. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/chat/connection.py +0 -0
  87. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/chat/handler.py +0 -0
  88. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/http/__init__.py +0 -0
  89. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/http/_base.py +0 -0
  90. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/http/client.py +0 -0
  91. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/http/endpoints.py +0 -0
  92. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/models/__init__.py +0 -0
  93. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/models/chat.py +0 -0
  94. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/models/live.py +0 -0
  95. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/models/reconnect.py +0 -0
  96. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/src/chzzk/unofficial/models/user.py +0 -0
  97. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/__init__.py +0 -0
  98. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/__init__.py +0 -0
  99. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_category.py +0 -0
  100. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_channel.py +0 -0
  101. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_chat.py +0 -0
  102. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_live.py +0 -0
  103. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_restriction.py +0 -0
  104. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_session.py +0 -0
  105. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/api/test_user.py +0 -0
  106. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/auth/__init__.py +0 -0
  107. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/auth/test_oauth.py +0 -0
  108. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/cli/__init__.py +0 -0
  109. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/cli/test_formatter.py +0 -0
  110. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/cli/test_writers.py +0 -0
  111. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/realtime/__init__.py +0 -0
  112. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/realtime/test_client.py +0 -0
  113. {chzzk_python-0.9.3 → chzzk_python-0.11.0}/tests/test_client.py +0 -0
@@ -49,3 +49,11 @@ CHZZK_CHAT_OUTPUT_DIR=
49
49
 
50
50
  # Output format: jsonl, txt (default: jsonl)
51
51
  CHZZK_CHAT_OUTPUT_FORMAT=
52
+
53
+ # Chat Monitoring Configuration
54
+ # Interval for polling live status in seconds (default: 10)
55
+ CHZZK_POLL_INTERVAL=
56
+
57
+ # Enable automatic reconnection when stream restarts (default: true)
58
+ # Set to "false" or "0" to disable
59
+ CHZZK_AUTO_RECONNECT=
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chzzk-python
3
- Version: 0.9.3
3
+ Version: 0.11.0
4
4
  Summary: Unofficial Python SDK for Chzzk (NAVER Live Streaming Platform) API
5
5
  Project-URL: Homepage, https://github.com/hypn4/chzzk-python
6
6
  Project-URL: Repository, https://github.com/hypn4/chzzk-python
@@ -30,6 +30,7 @@ Requires-Dist: websocket-client>=1.9.0
30
30
  Requires-Dist: websockets>=12.0
31
31
  Provides-Extra: cli
32
32
  Requires-Dist: prompt-toolkit>=3.0.52; extra == 'cli'
33
+ Requires-Dist: qrcode>=8.2; extra == 'cli'
33
34
  Requires-Dist: rich>=14.3.1; extra == 'cli'
34
35
  Requires-Dist: typer>=0.15.0; extra == 'cli'
35
36
  Description-Content-Type: text/markdown
@@ -356,6 +357,56 @@ async with AsyncUnofficialChatClient(
356
357
  await chat.run_forever()
357
358
  ```
358
359
 
360
+ ### Auto-Reconnection & Monitoring Options
361
+
362
+ The unofficial chat client automatically reconnects when the stream restarts or the chat channel changes. You can customize this behavior:
363
+
364
+ ```python
365
+ from chzzk.unofficial import AsyncUnofficialChatClient
366
+
367
+ chat = AsyncUnofficialChatClient(
368
+ nid_aut="...",
369
+ nid_ses="...",
370
+ # Auto-reconnect settings
371
+ auto_reconnect=True, # Enable auto-reconnection (default: True)
372
+ poll_interval=10.0, # Status polling interval in seconds (default: 10)
373
+ max_reconnect_attempts=5, # Max reconnection attempts (default: 5)
374
+ reconnect_backoff_base=1.0, # Backoff base delay in seconds (default: 1)
375
+ reconnect_backoff_max=30.0, # Max backoff delay in seconds (default: 30)
376
+ reconnect_wait_timeout=None, # Reconnection wait timeout (None = infinite)
377
+ )
378
+
379
+ # Event handlers for connection status
380
+ @chat.on_live
381
+ async def on_live(event):
382
+ print(f"Stream started: {event.live_title}")
383
+
384
+ @chat.on_offline
385
+ async def on_offline(event):
386
+ print("Stream ended, waiting for restart...")
387
+
388
+ @chat.on_reconnect
389
+ async def on_reconnect(event):
390
+ print(f"Reconnected! (attempt {event.attempt})")
391
+
392
+ @chat.on_reconnect_error
393
+ async def on_reconnect_error(error):
394
+ print(f"Reconnection failed: {error}")
395
+ ```
396
+
397
+ For long-running monitoring applications, you can configure infinite retry behavior:
398
+
399
+ ```python
400
+ from chzzk.unofficial.chat.monitor import MonitorConfig
401
+
402
+ # Create a custom monitor config
403
+ config = MonitorConfig(
404
+ poll_interval_seconds=10.0, # Poll every 10 seconds
405
+ max_consecutive_failures=10, # Trigger error callback after 10 failures
406
+ infinite_retry=True, # Continue monitoring even after failures
407
+ )
408
+ ```
409
+
359
410
  ### How to Get Naver Cookies
360
411
 
361
412
  1. Log in to Naver
@@ -382,7 +433,13 @@ A CLI is available for quick access to the unofficial API features.
382
433
  ### Authentication
383
434
 
384
435
  ```bash
385
- # Save your Naver cookies (interactive)
436
+ # Login via Naver QR code (recommended)
437
+ chzzk auth qr
438
+
439
+ # Login via Naver QR code with custom timeout
440
+ chzzk auth qr --timeout 60
441
+
442
+ # Save your Naver cookies manually (interactive)
386
443
  chzzk auth login
387
444
 
388
445
  # Check authentication status
@@ -424,6 +481,12 @@ chzzk chat watch CHANNEL_ID --output chat.txt --output-format txt
424
481
  # Creates: {channel_id}_{live_id}_{YYYYMMDD}.jsonl
425
482
  chzzk chat watch CHANNEL_ID --output-dir ./logs
426
483
 
484
+ # Disable auto-reconnection
485
+ chzzk chat watch CHANNEL_ID --no-auto-reconnect
486
+
487
+ # Custom poll interval (seconds)
488
+ chzzk chat watch CHANNEL_ID --poll-interval 5
489
+
427
490
  # Send a single message (requires authentication)
428
491
  chzzk chat send CHANNEL_ID "Hello!"
429
492
 
@@ -461,6 +524,8 @@ chzzk chat send CHANNEL_ID -i --offline
461
524
  | `CHZZK_CHAT_OUTPUT` | Default chat output file path |
462
525
  | `CHZZK_CHAT_OUTPUT_DIR` | Default chat output directory (auto-generates filename) |
463
526
  | `CHZZK_CHAT_OUTPUT_FORMAT` | Default chat output format (jsonl, txt) |
527
+ | `CHZZK_POLL_INTERVAL` | Live status polling interval in seconds (default: 10) |
528
+ | `CHZZK_AUTO_RECONNECT` | Enable auto-reconnection (default: true, set "false" to disable) |
464
529
 
465
530
  ## Examples
466
531
 
@@ -320,6 +320,56 @@ async with AsyncUnofficialChatClient(
320
320
  await chat.run_forever()
321
321
  ```
322
322
 
323
+ ### Auto-Reconnection & Monitoring Options
324
+
325
+ The unofficial chat client automatically reconnects when the stream restarts or the chat channel changes. You can customize this behavior:
326
+
327
+ ```python
328
+ from chzzk.unofficial import AsyncUnofficialChatClient
329
+
330
+ chat = AsyncUnofficialChatClient(
331
+ nid_aut="...",
332
+ nid_ses="...",
333
+ # Auto-reconnect settings
334
+ auto_reconnect=True, # Enable auto-reconnection (default: True)
335
+ poll_interval=10.0, # Status polling interval in seconds (default: 10)
336
+ max_reconnect_attempts=5, # Max reconnection attempts (default: 5)
337
+ reconnect_backoff_base=1.0, # Backoff base delay in seconds (default: 1)
338
+ reconnect_backoff_max=30.0, # Max backoff delay in seconds (default: 30)
339
+ reconnect_wait_timeout=None, # Reconnection wait timeout (None = infinite)
340
+ )
341
+
342
+ # Event handlers for connection status
343
+ @chat.on_live
344
+ async def on_live(event):
345
+ print(f"Stream started: {event.live_title}")
346
+
347
+ @chat.on_offline
348
+ async def on_offline(event):
349
+ print("Stream ended, waiting for restart...")
350
+
351
+ @chat.on_reconnect
352
+ async def on_reconnect(event):
353
+ print(f"Reconnected! (attempt {event.attempt})")
354
+
355
+ @chat.on_reconnect_error
356
+ async def on_reconnect_error(error):
357
+ print(f"Reconnection failed: {error}")
358
+ ```
359
+
360
+ For long-running monitoring applications, you can configure infinite retry behavior:
361
+
362
+ ```python
363
+ from chzzk.unofficial.chat.monitor import MonitorConfig
364
+
365
+ # Create a custom monitor config
366
+ config = MonitorConfig(
367
+ poll_interval_seconds=10.0, # Poll every 10 seconds
368
+ max_consecutive_failures=10, # Trigger error callback after 10 failures
369
+ infinite_retry=True, # Continue monitoring even after failures
370
+ )
371
+ ```
372
+
323
373
  ### How to Get Naver Cookies
324
374
 
325
375
  1. Log in to Naver
@@ -346,7 +396,13 @@ A CLI is available for quick access to the unofficial API features.
346
396
  ### Authentication
347
397
 
348
398
  ```bash
349
- # Save your Naver cookies (interactive)
399
+ # Login via Naver QR code (recommended)
400
+ chzzk auth qr
401
+
402
+ # Login via Naver QR code with custom timeout
403
+ chzzk auth qr --timeout 60
404
+
405
+ # Save your Naver cookies manually (interactive)
350
406
  chzzk auth login
351
407
 
352
408
  # Check authentication status
@@ -388,6 +444,12 @@ chzzk chat watch CHANNEL_ID --output chat.txt --output-format txt
388
444
  # Creates: {channel_id}_{live_id}_{YYYYMMDD}.jsonl
389
445
  chzzk chat watch CHANNEL_ID --output-dir ./logs
390
446
 
447
+ # Disable auto-reconnection
448
+ chzzk chat watch CHANNEL_ID --no-auto-reconnect
449
+
450
+ # Custom poll interval (seconds)
451
+ chzzk chat watch CHANNEL_ID --poll-interval 5
452
+
391
453
  # Send a single message (requires authentication)
392
454
  chzzk chat send CHANNEL_ID "Hello!"
393
455
 
@@ -425,6 +487,8 @@ chzzk chat send CHANNEL_ID -i --offline
425
487
  | `CHZZK_CHAT_OUTPUT` | Default chat output file path |
426
488
  | `CHZZK_CHAT_OUTPUT_DIR` | Default chat output directory (auto-generates filename) |
427
489
  | `CHZZK_CHAT_OUTPUT_FORMAT` | Default chat output format (jsonl, txt) |
490
+ | `CHZZK_POLL_INTERVAL` | Live status polling interval in seconds (default: 10) |
491
+ | `CHZZK_AUTO_RECONNECT` | Enable auto-reconnection (default: true, set "false" to disable) |
428
492
 
429
493
  ## Examples
430
494
 
@@ -320,6 +320,56 @@ async with AsyncUnofficialChatClient(
320
320
  await chat.run_forever()
321
321
  ```
322
322
 
323
+ ### 자동 재연결 및 모니터링 옵션
324
+
325
+ 비공식 채팅 클라이언트는 방송이 재시작되거나 채팅 채널이 변경될 때 자동으로 재연결됩니다. 이 동작을 커스터마이즈할 수 있습니다:
326
+
327
+ ```python
328
+ from chzzk.unofficial import AsyncUnofficialChatClient
329
+
330
+ chat = AsyncUnofficialChatClient(
331
+ nid_aut="...",
332
+ nid_ses="...",
333
+ # 자동 재연결 설정
334
+ auto_reconnect=True, # 자동 재연결 활성화 (기본값: True)
335
+ poll_interval=10.0, # 상태 폴링 간격 (초, 기본값: 10)
336
+ max_reconnect_attempts=5, # 최대 재연결 시도 횟수 (기본값: 5)
337
+ reconnect_backoff_base=1.0, # 백오프 기본 딜레이 (초, 기본값: 1)
338
+ reconnect_backoff_max=30.0, # 최대 백오프 딜레이 (초, 기본값: 30)
339
+ reconnect_wait_timeout=None, # 재연결 대기 타임아웃 (None = 무한 대기)
340
+ )
341
+
342
+ # 연결 상태 이벤트 핸들러
343
+ @chat.on_live
344
+ async def on_live(event):
345
+ print(f"방송 시작: {event.live_title}")
346
+
347
+ @chat.on_offline
348
+ async def on_offline(event):
349
+ print("방송 종료, 재시작 대기 중...")
350
+
351
+ @chat.on_reconnect
352
+ async def on_reconnect(event):
353
+ print(f"재연결 성공! (시도 {event.attempt}회)")
354
+
355
+ @chat.on_reconnect_error
356
+ async def on_reconnect_error(error):
357
+ print(f"재연결 실패: {error}")
358
+ ```
359
+
360
+ 장시간 모니터링 애플리케이션의 경우 무한 재시도 동작을 설정할 수 있습니다:
361
+
362
+ ```python
363
+ from chzzk.unofficial.chat.monitor import MonitorConfig
364
+
365
+ # 커스텀 모니터 설정 생성
366
+ config = MonitorConfig(
367
+ poll_interval_seconds=10.0, # 10초마다 폴링
368
+ max_consecutive_failures=10, # 10회 연속 실패 후 에러 콜백 호출
369
+ infinite_retry=True, # 실패 후에도 계속 모니터링
370
+ )
371
+ ```
372
+
323
373
  ### 네이버 쿠키 획득 방법
324
374
 
325
375
  1. 네이버에 로그인
@@ -346,7 +396,13 @@ except ChatConnectionError as e:
346
396
  ### 인증
347
397
 
348
398
  ```bash
349
- # 네이버 쿠키 저장 (대화형)
399
+ # 네이버 QR 코드로 로그인 (권장)
400
+ chzzk auth qr
401
+
402
+ # 타임아웃 설정과 함께 QR 코드 로그인
403
+ chzzk auth qr --timeout 60
404
+
405
+ # 네이버 쿠키 수동 저장 (대화형)
350
406
  chzzk auth login
351
407
 
352
408
  # 인증 상태 확인
@@ -388,6 +444,12 @@ chzzk chat watch CHANNEL_ID --output chat.txt --output-format txt
388
444
  # 생성 형식: {channel_id}_{live_id}_{YYYYMMDD}.jsonl
389
445
  chzzk chat watch CHANNEL_ID --output-dir ./logs
390
446
 
447
+ # 자동 재연결 비활성화
448
+ chzzk chat watch CHANNEL_ID --no-auto-reconnect
449
+
450
+ # 커스텀 폴링 간격 (초)
451
+ chzzk chat watch CHANNEL_ID --poll-interval 5
452
+
391
453
  # 단일 메시지 전송 (인증 필요)
392
454
  chzzk chat send CHANNEL_ID "안녕하세요!"
393
455
 
@@ -425,6 +487,8 @@ chzzk chat send CHANNEL_ID -i --offline
425
487
  | `CHZZK_CHAT_OUTPUT` | 기본 채팅 출력 파일 경로 |
426
488
  | `CHZZK_CHAT_OUTPUT_DIR` | 기본 채팅 출력 디렉토리 (파일명 자동 생성) |
427
489
  | `CHZZK_CHAT_OUTPUT_FORMAT` | 기본 채팅 출력 형식 (jsonl, txt) |
490
+ | `CHZZK_POLL_INTERVAL` | 라이브 상태 폴링 간격 (초, 기본값: 10) |
491
+ | `CHZZK_AUTO_RECONNECT` | 자동 재연결 활성화 (기본값: true, 비활성화: "false") |
428
492
 
429
493
  ## 예제 코드
430
494
 
@@ -18,3 +18,11 @@ CHZZK_NID_SES=your-nid-ses-cookie
18
18
  # 시청할 채널 ID (선택사항, 명령행에서도 지정 가능)
19
19
  # 채널 ID는 https://chzzk.naver.com/채널ID 형식의 URL에서 확인 가능
20
20
  CHZZK_CHANNEL_ID=
21
+
22
+ # Chat Monitoring Configuration
23
+ # Interval for polling live status in seconds (default: 10)
24
+ CHZZK_POLL_INTERVAL=
25
+
26
+ # Enable automatic reconnection when stream restarts (default: true)
27
+ # Set to "false" or "0" to disable
28
+ CHZZK_AUTO_RECONNECT=
@@ -38,6 +38,7 @@ cli = [
38
38
  "typer>=0.15.0",
39
39
  "rich>=14.3.1",
40
40
  "prompt-toolkit>=3.0.52",
41
+ "qrcode>=8.2",
41
42
  ]
42
43
 
43
44
  [project.scripts]
@@ -59,6 +60,7 @@ dev = [
59
60
  "pytest-asyncio>=1.3.0",
60
61
  "pytest-httpx>=0.35.0",
61
62
  "python-dotenv>=1.2.1",
63
+ "pyzbar>=0.1.9",
62
64
  "ruff>=0.14.13",
63
65
  ]
64
66
 
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.9.3'
32
- __version_tuple__ = version_tuple = (0, 9, 3)
31
+ __version__ = version = '0.11.0'
32
+ __version_tuple__ = version_tuple = (0, 11, 0)
33
33
 
34
34
  __commit_id__ = commit_id = None