Network

Network

class Network(**kwargs)

Implements the network api endpoints.

clear_banned(**kwargs) → None

Clear banned node list.

Parameters:**kwargs – Extra keyword arguments.
Returns:None
Raises:APIError – Error thrown by node API. See message for details.
disconnect(peer_address: str, **kwargs) → None

Disconnect from a node.

Parameters:
  • peer_address (str) – The peer endpoint.
  • **kwargs – Extra keyword arguments.
Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

get_bans(**kwargs) → List[pystratis.api.network.responsemodels.bannedpeermodel.BannedPeerModel]

Get a list of banned peers.

Parameters:**kwargs – Extra keyword arguments.
Returns:A list of banned peers with information on duration and reason for ban.
Return type:List[BannedPeerModel]
Raises:APIError – Error thrown by node API. See message for details.
set_ban(ban_command: str, ban_duration_seconds: int, peer_address: str, **kwargs) → None

Set a banned node.

Parameters:
  • ban_command (str) – Allowed commands [add, remove].
  • ban_duration_seconds (int) – The ban duration in seconds.
  • peer_address (str) – The peer address to ban/unban.
  • **kwargs – Extra keyword arguments.
Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

BannedPeerModel

class BannedPeerModel

A pydantic model describing a banned peer.