From 2f32d949b4cd29b84f7b763dd09106c03a0713f4 Mon Sep 17 00:00:00 2001 From: missytake Date: Wed, 2 Mar 2022 20:32:54 +0100 Subject: [PATCH] [mastodon] Import mastodon API correctly --- kibicara/platforms/mastodon/webapi.py | 2 +- kibicara/webapi/__init__.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kibicara/platforms/mastodon/webapi.py b/kibicara/platforms/mastodon/webapi.py index 03a7440..bfaa7fc 100644 --- a/kibicara/platforms/mastodon/webapi.py +++ b/kibicara/platforms/mastodon/webapi.py @@ -159,7 +159,7 @@ async def mastodon_create(instance_url, username, password, hood=Depends(get_hoo except MastodonError: logger.warning("Login to Mastodon failed.", exc_info=True) return # show error to user - MastodonAccount.objects.create( + return await MastodonAccount.objects.create( hood=hood, instance=instance, access_token=access_token, diff --git a/kibicara/webapi/__init__.py b/kibicara/webapi/__init__.py index 0572d69..29c01f6 100644 --- a/kibicara/webapi/__init__.py +++ b/kibicara/webapi/__init__.py @@ -15,6 +15,7 @@ from fastapi import APIRouter from kibicara.platforms.email.webapi import router as email_router from kibicara.platforms.telegram.webapi import router as telegram_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 twitter_callback_router from kibicara.webapi.admin import router as admin_router @@ -37,6 +38,9 @@ hoods_router.include_router( hoods_router.include_router( 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']) hoods_router.include_router(email_router, prefix='/{hood_id}/email', tags=['email']) router.include_router(hoods_router, prefix='/hoods')