Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yupix/fastapi-misskey
FastAPI Misskey extension library
https://github.com/yupix/fastapi-misskey
fastapi misskey
Last synced: 4 days ago
JSON representation
FastAPI Misskey extension library
- Host: GitHub
- URL: https://github.com/yupix/fastapi-misskey
- Owner: yupix
- License: mit
- Created: 2021-12-06T20:14:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T16:20:05.000Z (over 2 years ago)
- Last Synced: 2024-05-23T03:31:42.452Z (6 months ago)
- Topics: fastapi, misskey
- Language: Python
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI Misskey
このライブラリはFastAPIにMisskeyの認証を作成するお手伝いをするライブラリです
## Example
```python
from typing import Optionalfrom fastapi import Depends, FastAPI
from fastapi_misskey.client import MisskeyAuthClient
app = FastAPI()
misskey = MisskeyAuthClient(
'https://example.com',
'test',
'http://localhost:8000/callback',
description='FastAPI Misskey Auth'
)@app.get('/login')
async def login():
return {'url': await misskey.get_auth_url()}@app.get('/callback')
async def callback(session: Optional[str] = None, token: Optional[str] = None):
token, user = await misskey.get_access_token(session, token)
return {'token': token, 'user': user}@app.get('/profile')
async def profile(user=Depends(misskey.get_user)):
if user.get('error'):
return user
else:
return {'user': user}```
## Inspired by
[fastapi-discord](https://github.com/Tert0/fastapi-discord)
Thanks to @Tert0