File size: 678 Bytes
a29f872
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Public connection instructions shared by browsers and automation."""

from pathlib import Path

from fastapi import APIRouter
from fastapi.responses import FileResponse

connection_docs_router = APIRouter()
CONNECTION_GUIDE = Path(__file__).resolve().parents[3] / "CONNECTION.md"


@connection_docs_router.api_route("/api-docs", methods=["GET", "HEAD"], include_in_schema=False)
async def connection_guide():
    return FileResponse(
        CONNECTION_GUIDE,
        media_type="text/plain; charset=utf-8",
        filename="CONNECTION.md",
        content_disposition_type="inline",
        headers={"X-Content-Type-Options": "nosniff", "Cache-Control": "no-cache"},
    )