8.2. Transmitter classes

class pingparsing.PingTransmitter[source]

Transmitter class to send ICMP packets by using the OS built-in ping command.

count: Optional[int] = None

Number of sending ICMP packets. This attribute ignored if the value is None.

packet_size: Optional[int] = None

Specifies the number of data bytes to be sent.

ttl: Optional[int] = None

Specifies the Time to Live.

ping_option: Union[str, Sequence[str]] = ""

Additional ping command option.

interface: Optional[str] = None

Interface name or zone-id. The attribute required when destination is IPv6 link-local scope address.

timestamp: bool = False

[Only for Linux environment] If True, add timestamp for each ping result. Defaults to False.

auto_codepage: bool = True

[Only for Windows environment] Automatically change code page if True. Defaults to True.

property deadline: Optional[Time]

Timeout before ping exits. You can specify either a number or a string (e.g. "1sec"). If only a number is specified and a unit not found, the unit will be considered as seconds.

Unit

Available specifiers (str)

days

d/day/days

hours

h/hour/hours

minutes

m/min/mins/minute/minutes

seconds

s/sec/secs/second/seconds

milliseconds

ms/msec/msecs/millisecond/milliseconds

microseconds

us/usec/usecs/microsecond/microseconds

If both deadline and count are None, deadline is automatically set to the default value (3 seconds). Defaults to None.

Returns

deadline

Return type

humanreadable.Time

property destination: str

Hostname or IP-address (IPv4/IPv6) to sending ICMP packets.

property destination_host: str

Alias to destination

ping() PingResult[source]

Sending ICMP packets.

Returns

ping command execution result.

Return type

PingResult

Raises

ValueError – If parameters not valid.

property timeout: Optional[Time]

Time to wait for a response per packet. You can specify either a number or a string (e.g. "1sec"). If only a number is specified and a unit not found, the unit will be considered as seconds.

Unit

Available specifiers (str)

days

d/day/days

hours

h/hour/hours

minutes

m/min/mins/minute/minutes

seconds

s/sec/secs/second/seconds

milliseconds

ms/msec/msecs/millisecond/milliseconds

microseconds

us/usec/usecs/microsecond/microseconds

Use system default timeout if the value is None. Defaults to None. If the system does not support timeout in milliseconds, round up as seconds.

Returns

timeout

Return type

humanreadable.Time

class pingparsing.PingResult(stdout, stderr, returncode)[source]

Data class to store ping command execution result.

stdout: Optional[str]

Standard output of ping command execution result.

stderr: Optional[str]

Standard error of ping command execution result.

returncode: int

Return code of ping command execution result.