MiAuth class
- class misskey.MiAuth(address: str = 'https://misskey.io', session_id: Optional[Union[uuid.UUID, str]] = None, name: str = 'Misskey.py', icon: Optional[str] = None, callback: Optional[str] = None, permission: Optional[Union[List[Optional[Union[misskey.enum.Permissions, str]]], Tuple[Optional[misskey.enum.Permissions]], Set[Optional[misskey.enum.Permissions]]]] = None, session: Optional[requests.sessions.Session] = None)[ソース]
Misskey Authentication Class
- Args:
address (str): Instance address. You can also include the URL protocol. If not specified, it will be automatically recognized as
https
.session_id (
uuid.UUID
orstr
, optional): Session ID for performing MiAuth. If not specified, it will be set automatically.name (
str
, optional): App name.icon (
str
, optional): The URL of the icon.callback (
str
, optional): App callback URL.permission (
list
ofstr
, optional): The permissions that the app can use. You can specify an enumeration of Permissions.session (
requests.Session
, optional): If you have prepared therequests.Session
class yourself, you can assign it here. Normally you do not need to specify it.
- property address: str
Misskey instance address for MiAuth. Cannot be edited.
- property callback: Optional[str]
App callback URL.
It can be changed by assignment.
If using
del
,icon
will beNone
.
- check() str [ソース]
Validate MiAuth authentication.
- Returns:
str: If the authentication is successful, a MiAuth token will be returned.
- Note:
The token obtained by this method is also assigned to the property
token
.- Raises:
MisskeyMiAuthFailedException: Raise if MiAuth authentication fails.
- generate_url() str [ソース]
Create a URL for your end user.
- Returns:
str: The URL for the end user is returned. Instruct the end user to open it in a web browser or the like.
- property icon: Optional[str]
The URL of the icon.
It can be changed by assignment.
If using
del
,icon
will beNone
.
- property name: str
App name.
It can be changed by assignment.
- property permission: Optional[Union[List[Optional[Union[misskey.enum.Permissions, str]]], Tuple[Optional[misskey.enum.Permissions]], Set[misskey.enum.Permissions]]]
The permissions that the app can use.
- property session_id: Union[uuid.UUID, str]
Session ID for performing MiAuth. Cannot be edited.
- property token: Optional[str]
Contains the token authenticated by MiAuth. If not authenticated,
None
will be returned.