Skip to content

feature: fetch app docs_url #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: linter
  • Loading branch information
chipytux committed May 15, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 87263384d40af0d2e61aaa058903b6e12cc8865e
7 changes: 4 additions & 3 deletions src/fastapi_cli/cli.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

import typer
import uvicorn
from fastapi import FastAPI
from rich import print
from rich.padding import Padding
from rich.panel import Panel
@@ -46,11 +47,11 @@ def callback(
"""


def _get_docs_url(uvicorn_path: str) -> str:
def _get_docs_url(uvicorn_path: str) -> str | None:
module_path, app_name = uvicorn_path.split(sep=":")
module = importlib.import_module(module_path)
app = getattr(module, app_name)
return app.docs_url
fastapi_app: FastAPI = getattr(module, app_name)
return fastapi_app.docs_url


def _run(