atproto_oauth.scopes
- class atproto_oauth.scopes.AccountPermission(attr: str, action: Tuple[str, ...])
Bases:
objectPermission for account attribute access.
- classmethod from_string(scope: str) AccountPermission | None
- classmethod from_syntax(syntax: ScopeStringSyntax) AccountPermission | None
- attr: str
- class atproto_oauth.scopes.BlobPermission(accept: Tuple[str, ...])
Bases:
objectPermission for blob uploads.
- classmethod from_string(scope: str) BlobPermission | None
- classmethod from_syntax(syntax: ScopeStringSyntax) BlobPermission | None
- class atproto_oauth.scopes.IdentityPermission(attr: str)
Bases:
objectPermission for identity operations.
- classmethod from_string(scope: str) IdentityPermission | None
- classmethod from_syntax(syntax: ScopeStringSyntax) IdentityPermission | None
- attr: str
- class atproto_oauth.scopes.IncludeScope(nsid: str, aud: str | None = None)
Bases:
objectAn
include:scope that references a lexicon permission set.Not a permission itself — it resolves via a lexicon definition to produce
RepoPermissionand/orRpcPermissioninstances.- classmethod from_string(scope: str) IncludeScope | None
- classmethod from_syntax(syntax: ScopeStringSyntax) IncludeScope | None
- is_parent_authority_of(other_nsid: str) bool
Check if
other_nsidis in the same namespace authority.The namespace authority is everything before the last
.segment ofself.nsid.other_nsidmust start with that same prefix.
- nsid: str
- class atproto_oauth.scopes.RepoPermission(collection: Tuple[str, ...], action: Tuple[str, ...])
Bases:
objectPermission for repository record operations.
- classmethod from_string(scope: str) RepoPermission | None
- classmethod from_syntax(syntax: ScopeStringSyntax) RepoPermission | None
- class atproto_oauth.scopes.RpcPermission(aud: str, lxm: Tuple[str, ...])
Bases:
objectPermission for RPC (XRPC) method calls.
- classmethod from_string(scope: str) RpcPermission | None
- classmethod from_syntax(syntax: ScopeStringSyntax) RpcPermission | None
- aud: str
- exception atproto_oauth.scopes.ScopeMissingError(scope: str)
Bases:
OAuthErrorA required scope was not granted.
- class atproto_oauth.scopes.ScopePermissions(scope: str | None = None)
Bases:
objectTyped permission checker wrapping a
ScopesSet.Example:
perms = ScopePermissions('atproto repo:com.example.record blob:*/*') perms.allows_repo(collection='com.example.record', action='create') # True
- class atproto_oauth.scopes.ScopePermissionsTransition(scope: str | None = None)
Bases:
ScopePermissionsPermission checker with transition scope support.
Transition scopes are legacy grants from the pre-scoped OAuth era:
transition:generic: all repo, all blob, all non-chat.bsky RPCtransition:chat.bsky: all chat.bsky.* RPC methodstransition:email: read access to account email
- property has_transition_chat_bsky: bool
- property has_transition_email: bool
- property has_transition_generic: bool
- class atproto_oauth.scopes.ScopesSet(scopes: Iterable[str] | None = None)
Bases:
objectA set of OAuth scope strings with permission matching.
Example:
scopes = ScopesSet.from_string('atproto repo:com.example.record blob:*/*') scopes.matches('repo', collection='com.example.record', action='create') # True scopes.matches('blob', mime='image/png') # True- assert_matches(resource: str, **kwargs: Any) None
Ensure that a scope grants the requested permission.
- Raises:
atproto_oauth.exceptions.ScopeMissingError – No scope grants the permission.
- classmethod from_string(scope_string: str | None = None) ScopesSet
Parse a space-separated scope string.
- matches(resource: str, **kwargs: Any) bool
Check if any scope in the set grants the requested permission.
- Parameters:
resource – The resource type (
repo,blob,rpc,account,identity).**kwargs – Permission-specific parameters passed to
matches().
- Returns:
Whether any scope grants the permission.
- Return type:
- property size: int