on_transfer Event

Fired while the article text gets transferred (to or from the NewsServer ).

Syntax

class NNTPTransferEventParams(object):
  @property
  def direction() -> int: ...
  @property
  def bytes_transferred() -> int: ...
  @property
  def percent_done() -> int: ...
  @property
  def text() -> bytes: ...
  @property
  def eol() -> bool: ...

# In class NNTP:
@property
def on_transfer() -> Callable[[NNTPTransferEventParams], None]: ...
@on_transfer.setter
def on_transfer(event_hook: Callable[[NNTPTransferEventParams], None]) -> None: ...

Remarks

One or more on_transfer events are fired during article retrieval. The Text parameter contains the portion of article data being retrieved.

The BytesTransferred parameter contains the number of bytes transferred since the beginning of the article, including header bytes.

One or more on_transfer events are also fired during article posting. Articles consist of article_text and an optional attached_file. The BytesTransferred parameter shows the number of bytes sent starting from the beginning of article_text and/or attached_file.

The on_transfer event is fired for every line of the article. For complete lines, there is no terminating newline at the end of the Text parameter, and EOL is True. The EOL parameter is False when a line is broken (usually for being too long).

The Direction parameter shows whether the client (0) or the server (1) is sending the data.

The PercentDone parameter shows the progress of the transfer in the corresponding direction. If PercentDone can not be calculated the value will be -1.

Note that events are not re-entrant. Performing time consuming operations within this event will prevent it from firing again in a timely manner and may impact overall performance.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Python Edition - Version 20.0 [Build 8307]