fastapi Questions

5

When I try to install FastAPI. I am using Python 3.10.2, Pycharm. I have already installed build tools which is given by the link. and updated setuptools, wheel and pip using pip install --upgrade...
Merrymaking asked 25/2, 2022 at 13:3

1

Solved

For some reason handling Form Data and File Upload at the same time raises an error. from typing import Annotated from pydantic import BaseModel, StringConstraints, EmailStr class RouteBody(BaseMod...
Clementclementas asked 24/9, 2024 at 18:59

4

Solved

I have a small, test FastAPI web application that is serving a simple HTML page that requires a css style sheet located in the static folder. It is installed on a Linode server (Ubuntu 20.04 LTS), ...
Trencher asked 15/10, 2021 at 12:53

3

I'm trying to connect the alembic library to the databases and sqlalchemy libraries. As a guide, I use this example link My projects file: db.py from databases import Database from sqlalchemy impor...
Yolk asked 15/7, 2020 at 15:8

4

Solved

I have similar apps on Flask and FastAPI. When I do this curl requests with Flask, that is all right: Without TLS: curl -X POST -H "Content-Type: application/json" -d '{"method"...
Osana asked 13/3, 2021 at 11:34

4

How to convert string to model type in FastAPI? If I have Student model and want to convert string student to type model. How to convert it? engine = create_engine(SQLALCHAMY_DATABASE_URL,pool_pre_...
Agenesis asked 30/5, 2023 at 10:33

1

I found two approaches to working with databases in FastAPI. Are there any fundamental differences? if so which approach is preferable? Approach 1 This is found in official FastAPI-fullstack exampl...
Fung asked 15/8, 2021 at 16:14

2

Solved

The FastAPI application I started working on, uses several services, which I want to initialize only once, when the application starts and then use the methods of this object in different places. I...
Homologate asked 23/5, 2021 at 20:16

4

Solved

What is the recommended way to validate the access token in backend? Any library that handles it? Another team has implemented the frontend they send the access token in the Bearer attributed in th...
Orelle asked 11/8, 2023 at 19:23

2

I have the following models/schemas: class UserBase(SQLModel): full_name: str email: EmailStr is_active: bool = True is_superuser: bool = False class UserRead(UserBase): id: uuid.UUID clas...
Cybele asked 21/11, 2021 at 13:5

2

Solved

I'm using fastAPI python framework to build a simple POST/GET https server. On the client side, i send heartbeat POST messages every 10 seconds and i'd like to keep my connection open during this p...
Sturdy asked 7/12, 2021 at 18:36

2

Solved

I need to create a schema but it has a column called global, and when I try to write this, I got an error. class User(BaseModel): id:int global:bool I try to use another name, but gives another...
Obelisk asked 4/1, 2022 at 20:34

7

In pydantic is there a cleaner way to exclude multiple fields from the model, something like: class User(UserBase): class Config: exclude = ['user_id', 'some_other_field'] I am aware that fol...
Reikoreilly asked 5/1, 2022 at 3:31

4

I'm currently developing my first webapp, frontend with React and backend with FastAPI. I'm trying to test it out jointly with Chrome-- see if the frontend makes the correct API calls to backend, a...
Chante asked 21/7, 2020 at 8:32

7

Solved

I want to use Arrow type in FastAPI response because I am using it already in SQLAlchemy model (thanks to sqlalchemy_utils). I prepared a small self-contained example with a minimal FastAPI app. I ...
Nachison asked 25/8, 2021 at 21:57

6

i'm trying to debug an application (a web api) that use FastAPI (uvicorn) I'm also using poetry and set the projev virtual environment in vscode. i read this tutorial to setup uvicorn and this one...
Cayuga asked 13/2, 2020 at 9:58

2

I was trying to write a fastapi post method as: @app.post('/method/final_path/', tags=['method/final_path']) When i do a postman call as https://......./method/final_path/ I get the expected resul...
Solipsism asked 17/11, 2021 at 15:52

1

I have tried everything I've been able to find, but I can't get tests to work when httpx AsyncClient is used. I encountered two errors when running a test: RuntimeError: This event loop is already...
Fibrosis asked 31/3, 2021 at 21:30

5

Solved

When I run my FastAPI server using uvicorn: uvicorn main:app --host 0.0.0.0 --port 8000 --log-level info The log I get after running the server: INFO: Started server process [405098] INFO: Waiting...
Galvez asked 16/7, 2020 at 12:10

2

I want to write tests for my FastAPI endpoints example for my code: from fastapi import FastAPI from fastapi.testclient import TestClient app = FastAPI() @app.get("/todos") async def ge...
Selfpreservation asked 26/4, 2022 at 7:2

4

Solved

How can i redirect a request with FastAPI if there is a HTTPException? In Flask we can achieve that like this: @app.errorhandler(404) def handle_404(e): if request.path.startswith('/api'): return...
Inessa asked 19/7, 2020 at 23:31

4

I'm trying to Dockerize my FastApi app, but it crashes with this error right after I run the command: docker-compose -f local.yml up -d Can anyone help me, please? Dockerfile: FROM python:3.6.11-a...
Longdrawn asked 13/5, 2022 at 22:11

4

Solved

I have a FastAPI app that is working as expected when running locally, however, I get an 'Internal Server Error' when I try to run in a Docker container. Here's the code for my app: from fastapi i...
Abnaki asked 12/6, 2020 at 19:47

3

Solved

I am working on a React frontend to chart some data from a fastapi backend. I am using a couple of dropdown components to change the month and year for the requested data. With the initial render t...
Bondmaid asked 1/11, 2023 at 18:12

2

Solved

I am using FastAPI to write a web service. It is good and fast. FastAPI is using pydantic models to validate input and output data, everything is good but when I want to declare a nested model for...
Westerly asked 29/4, 2020 at 8:15

© 2022 - 2025 — McMap. All rights reserved.