Skip to content
Discussion options

You must be logged in to vote

You can use servers parameter:

from fastapi import FastAPI
import yaml

app = FastAPI(servers=[{"url": "http://myserver.com"}])

def get_data():
    with open("/root/bot/price_data.yaml", "r") as d:
        data = yaml.load(d, Loader=yaml.FullLoader)
        return data

@app.get("/price_data")
async def price_data():
    data = get_data()
    return data

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #4714 on February 27, 2023 22:02.