info
info
¶
NIP-11 metadata container with HTTP info retrieval capabilities.
Pairs Nip11InfoData with
Nip11InfoLogs and provides
the execute() class method that performs the actual HTTP request to
retrieve a relay's
NIP-11
information document.
Note
The HTTP request converts the relay's WebSocket URL scheme (wss -> https,
ws -> http) and sends the Accept: application/nostr+json header
as required by the NIP-11 specification. Responses larger than 64 KB are
rejected to guard against resource exhaustion.
The SSL fallback strategy mirrors
connect_relay: clearnet relays
try verified SSL first, then fall back to CERT_NONE if
allow_insecure=True. Overlay networks always use an insecure SSL
context because the overlay provides its own encryption layer.
See Also
bigbrotr.nips.nip11.nip11.Nip11:
Top-level model that wraps this container.
bigbrotr.nips.base.BaseNipMetadata:
Base class providing from_dict() / to_dict() interface.
bigbrotr.models.metadata.MetadataType:
The NIP11_INFO variant used when storing these results.
Classes¶
Nip11InfoMetadata
¶
Bases: BaseNipMetadata
Container for NIP-11 info data and operation logs.
Provides the execute() class method for retrieving a relay's NIP-11
document over HTTP(S). The result always contains both a
Nip11InfoData object and a
Nip11InfoLogs object --
check logs.success for the operation status.
Warning
The execute() method never raises exceptions. All errors are
captured in the logs.reason field. Callers must always check
logs.success before accessing data fields.
See Also
bigbrotr.nips.nip11.nip11.Nip11.create:
Factory method that delegates to execute().
Functions¶
execute
async
classmethod
¶
execute(
relay: Relay,
timeout: float | None = None,
max_size: int | None = None,
proxy_url: str | None = None,
session: ClientSession | None = None,
*,
allow_insecure: bool = False,
) -> Self
Fetch the NIP-11 information document from a relay.
Connects via HTTP(S) with the Accept: application/nostr+json
header per the NIP-11 specification.
For clearnet HTTPS, verifies the certificate first and falls back to insecure if allow_insecure is True. Overlay networks always use an insecure SSL context (the overlay provides encryption). Plain HTTP connections use no SSL.
This method never raises and never returns None. Check
logs.success for the operation outcome.
Parameters:
-
relay(Relay) –Relay to fetch from.
-
timeout(float | None, default:None) –Request timeout in seconds (default: 10.0).
-
max_size(int | None, default:None) –Maximum response size in bytes (default: 64 KB).
-
proxy_url(str | None, default:None) –Optional SOCKS5 proxy URL for overlay networks.
-
session(ClientSession | None, default:None) –Optional shared
aiohttp.ClientSession. When provided, the session is reused and the caller retains ownership. WhenNone, a per-request session is created and closed automatically. -
allow_insecure(bool, default:False) –Fall back to unverified SSL on certificate errors (default: False).
Returns:
-
Self–An
Nip11InfoMetadatainstance with data and logs.
Source code in src/bigbrotr/nips/nip11/info.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |