nostr_tools.fetch_nip66

async nostr_tools.fetch_nip66(client, sec, pub, target_difficulty=None, event_creation_timeout=None)[source]

Fetch comprehensive connection metrics from the relay.

This function performs a complete connectivity test including connection establishment, read capability testing, and write capability testing.

Parameters:
  • client (Client) – An instance of Client (must not be already connected)

  • sec (str) – Private key for signing test events

  • pub (str) – Public key corresponding to the private key

  • target_difficulty (Optional[int]) – Proof-of-work difficulty for test events

  • event_creation_timeout (Optional[int]) – Timeout for event creation

Returns:

NIP-66 metadata or None if not available

Return type:

Optional[RelayMetadata.Nip66]

Raises:

ClientConnectionError – If client is already connected