[mastodon] Import mastodon API correctly

This commit is contained in:
missytake 2022-03-02 20:32:54 +01:00
parent f7e73ea407
commit 2f32d949b4
2 changed files with 5 additions and 1 deletions

View file

@ -159,7 +159,7 @@ async def mastodon_create(instance_url, username, password, hood=Depends(get_hoo
except MastodonError: except MastodonError:
logger.warning("Login to Mastodon failed.", exc_info=True) logger.warning("Login to Mastodon failed.", exc_info=True)
return # show error to user return # show error to user
MastodonAccount.objects.create( return await MastodonAccount.objects.create(
hood=hood, hood=hood,
instance=instance, instance=instance,
access_token=access_token, access_token=access_token,

View file

@ -15,6 +15,7 @@ from fastapi import APIRouter
from kibicara.platforms.email.webapi import router as email_router from kibicara.platforms.email.webapi import router as email_router
from kibicara.platforms.telegram.webapi import router as telegram_router from kibicara.platforms.telegram.webapi import router as telegram_router
from kibicara.platforms.test.webapi import router as test_router from kibicara.platforms.test.webapi import router as test_router
from kibicara.platforms.mastodon.webapi import router as mastodon_router
from kibicara.platforms.twitter.webapi import router as twitter_router from kibicara.platforms.twitter.webapi import router as twitter_router
from kibicara.platforms.twitter.webapi import twitter_callback_router from kibicara.platforms.twitter.webapi import twitter_callback_router
from kibicara.webapi.admin import router as admin_router from kibicara.webapi.admin import router as admin_router
@ -37,6 +38,9 @@ hoods_router.include_router(
hoods_router.include_router( hoods_router.include_router(
twitter_router, prefix='/{hood_id}/twitter', tags=['twitter'] twitter_router, prefix='/{hood_id}/twitter', tags=['twitter']
) )
hoods_router.include_router(
mastodon_router, prefix='/{hood_id}/mastodon', tags=['mastodon']
)
router.include_router(twitter_callback_router, prefix='/twitter', tags=['twitter']) router.include_router(twitter_callback_router, prefix='/twitter', tags=['twitter'])
hoods_router.include_router(email_router, prefix='/{hood_id}/email', tags=['email']) hoods_router.include_router(email_router, prefix='/{hood_id}/email', tags=['email'])
router.include_router(hoods_router, prefix='/hoods') router.include_router(hoods_router, prefix='/hoods')