-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
Description
Describe the bug
Importing openpyxl makes fastapi confuse types of query parameters.
To Reproduce
Here's a self-contained, minimal, reproducible, example with my use case:
import fastapi
import openpyxl # if comment out, the result would be OK
from typing import List, Union, Optional
app = fastapi.FastAPI()
@app.get('/')
def read_items(p: Optional[Union[int, str]] = None):
return isinstance(p, int) # if p = 1, return false!Description
- Open the browser and call the endpoint
/. - Input
p = 1. - It returns
false. - But I expected it to return
true. - If comment out
import openpyxl, the result would betrueas expected.
Environment
- OS: macOS
- FastAPI Version: 0.62.0
- Python version: 3.7.6