From 37f7b98c6796dfa6d60c8cd638a4677cbb1b2432 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 --- backend/src/kibicara/webapi/__init__.py | 4 ++++ kibicara/platforms/mastodon/webapi.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/kibicara/webapi/__init__.py b/backend/src/kibicara/webapi/__init__.py index 297ac3e..adc99ea 100644 --- a/backend/src/kibicara/webapi/__init__.py +++ b/backend/src/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 @@ -40,3 +41,6 @@ hoods_router.include_router( 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") +hoods_router.include_router( + mastodon_router, prefix="/{hood_id}/mastodon", tags=["mastodon"] +) 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,