NSID (NameSpaced ID)

NameSpaced IDs (NSIDs) are used throughout ATP to identify methods, records types, and other semantic information.

NSIDs use Reverse Domain-Name Notation with the additional constraint that the segments prior to the final segment must map to a valid domain name. For instance, the owner of example.com could use the ID of com.example.foo but could not use com.example.foo.bar unless they also control foo.example.com. These rules are to ensure that schemas are globally unique, have a clear authority mapping (to a registered domain), and can potentially be resolved by request.

More info: https://atproto.com/specs/nsid

class atproto_core.nsid.NSID(segments: ~typing.List[str] = <factory>)

Bases: object

NameSpaced IDs (NSIDs).

Examples

com.example.status

io.social.getFeed

net.users.bob.ping

property authority: str

Get authority of NSID.

com.example.thing ^^^^^^^^^^^——–> example.com

delim joined self.segments[:-1][::-1]

classmethod from_str(nsid: str) NSID

Create NSID instance from string.

property name: str

Get name.

segments: List[str]
atproto_core.nsid.validate_nsid(nsid: str, *, soft_fail: bool = False) bool

Validate NSID.

Parameters:
  • nsid – NSID to validate.

  • soft_fail – enable to return False on fall instead of exception

Returns:

Validation result.

Return type:

bool

Raises:

atproto.exceptions.InvalidNsidError – Invalid NSID exception.