Closed minaelee closed 2 weeks ago
Existing example with:
from fastapi import FastAPI, Server
resulted in ImportError: cannot import name 'Server' from 'fastapi'.
ImportError: cannot import name 'Server' from 'fastapi'
Per https://github.com/tiangolo/fastapi/pull/1547 tried:
from fastapi.openapi.models import Server
This resulted in 'Server' object has no attribute 'get' exception (supposed to be fixed in PR https://github.com/tiangolo/fastapi/pull/5917 but not merged).
'Server' object has no attribute 'get'
The working solution right now as described in https://github.com/tiangolo/fastapi/pull/1547 is to not use Server at all and pass a dictionary as shown in this commit.
Also see: https://fastapi.tiangolo.com/reference/fastapi/?h=docs_url#fastapi.FastAPI--example
Existing example with:
resulted in
ImportError: cannot import name 'Server' from 'fastapi'
.Per https://github.com/tiangolo/fastapi/pull/1547 tried:
This resulted in
'Server' object has no attribute 'get'
exception (supposed to be fixed in PR https://github.com/tiangolo/fastapi/pull/5917 but not merged).The working solution right now as described in https://github.com/tiangolo/fastapi/pull/1547 is to not use Server at all and pass a dictionary as shown in this commit.
Also see: https://fastapi.tiangolo.com/reference/fastapi/?h=docs_url#fastapi.FastAPI--example