Questions tagged [fastapi]

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

[FastAPI]Cannot delete s3 object with boto3 and all policy

I am trying to connect S3 to my FastAPI project. I've successfully uploaded images through IAM permissions and S3 bucket permissions settings, but I'm repeatedly facing 'Access Denied' errors when ...
Taeyoung's user avatar
0 votes
0 answers
10 views

Pydantic accept integer as string input

For a FastAPI Pydantic interface I want to be as tolerable as possible, such as receiving an integer for a string parameter and parse that integer to string: from pydantic import BaseModel class ...
Joost Döbken's user avatar
0 votes
0 answers
12 views

How to return both a dict and a file by an endpoint using FastAPI?

I need to return both a dict and a file using FastAPI. But I can only achieve so far returning a file. Could you please show me how to do it? Thanks. Expected Usage Primary usage The primary usage is ...
aura's user avatar
  • 393
0 votes
0 answers
4 views

How to Create a self-relation in mapped Table(model of the table didn't exists) in SQLAlchemy

I have a table 'employee' and I have added it in Metadata and created a mapper class. This employee table didn't have the Alchemy model as it already exists in the DB. Now I want to establish the Self-...
harry jame's user avatar
0 votes
0 answers
11 views

VUE+FASTAPI receiving 422 Unprocessable Entity when sending request form object for OAuth2PasswordRequestForm

I developing a site using Vue and FASTAPI. I am currently stuck with the error 422 Unprocessable Entity received from a FASTAPI Sever. As I understand 422 error cause when the request reached server ...
WIsh Suharitdamrong's user avatar
0 votes
1 answer
12 views

FastAPI upload a file and pass it into python-docx's Document

I want to upload an .docx document using FastAPI's method (https://fastapi.tiangolo.com/tutorial/request-forms-and-files/), and then pass that file (using bytes) into python-docx's Document. I've ...
Wojciech Ziarnik's user avatar
0 votes
0 answers
13 views

strawberry-FastAPI: Sending multiple parameters via curl?

I have a small service that uses FastAPI-Strawberry that accepts some files: import typing import strawberry from strawberry.file_uploads import Upload @strawberry.type class Mutation: @...
easythrees's user avatar
  • 1,554
0 votes
0 answers
22 views

FastAPI endpoint receiving bytes/file [duplicate]

how can I create a FastAPI endpoint that can receive the following request example. import requests # URL of your FastAPI endpoint url = "http://localhost:8000/upload/?param1=temp&param2=...
Viet Than's user avatar
  • 164
1 vote
1 answer
27 views

What is the JSON input format for a Lambda function for proxy integration?

I'm using AWS Lambda with an API Gateway proxy integration (AWS_PROXY) such that requests are passed directly without API Gateway imposing any routing. Lambda is hosting a FastAPI application and ...
jbuddy_13's user avatar
  • 936
0 votes
0 answers
24 views

Add endpoint to existing FastAPI server

I have a function that gets API endpoint and a function to serve on this endpoint: from api.server.create_new_game import create_new_game app = FastAPI() def handle_get_endpoints(app, endpoint, ...
user16713791's user avatar
0 votes
0 answers
19 views

Python-FastAPI-SocketIO - 403 forbidden

I am trying to implement socket programming using Python, FastAPI and SocketIO. When i try to connect to send the socket connect request the application is showing 403 error. My code: import socketio ...
Akhil  Chakicherla's user avatar
-1 votes
0 answers
53 views

Upload a file to AWS S3 with FastAPI

I'm working on a FastAPI endpoint to upload the provided file from user to an AWS bucket. To make sure my aws credentials and region is valid, I first tried the following code outside FastAPI (in a ...
Saeed Esmaili's user avatar
0 votes
0 answers
10 views

Log level of HttpException in FastAPI for failed login

In my FastAPI code, I have this: from fastapi import HTTPException # ... if not user: raise HTTPException( detail="User does not exist", status_code=HTTPStatus.NOT_FOUND ) ...
Kurt Bourbaki's user avatar
0 votes
0 answers
13 views

Delete many-to-many in MySQL database with FastAPI SQLAlchemy [ Internal Server Error:'int' object has no attribute 'query'"]

I want to make test CRUD app for study, but I have problem with delete opperaction, because I have many-to-many relationship,I think. Models: class Book(Base): tablename = 'books' id = Column(INTEGER(...
Teran's user avatar
  • 1
0 votes
1 answer
24 views

ignore security dependency if environment is set to local or dev

I have this dependency in my REST endpoint definition @api_router.post(path="/request") def post_request( request_body: RequestBody, access_token: AccessToken = Security(...
lapots's user avatar
  • 12.6k
-1 votes
0 answers
9 views

Using Fastapi and Modal Labs, how can I set the directory path to the tEmplates folder/ [duplicate]

I am deploying a Fastapi app using modal labs' containers. I want to create / mount a tempalates directory for my html files. Here is the code snippet: from fastapi import FastAPI, Request from ...
user1903663's user avatar
  • 1,711
0 votes
0 answers
8 views

Using Fastapi and Modal Labs, how can I set the directory path to the tEmplates folder/

I am deploying a Fastapi app using modal labs' containers. I want to create / mount a tempalates directory for my html files. Here is the code snippet: from fastapi import FastAPI, Request from ...
user1903663's user avatar
  • 1,711
0 votes
0 answers
25 views

Why doesn't the browser refresh the page?

The application runs on FastAPI. After receiving the POST request, the backend processes the information and must return the main page. The browser receives a 200 OK GET request, but does not go to ...
Twopercent's user avatar
0 votes
0 answers
26 views

How to use MongoObjectId in pydanic models

I have created a simple REST API using Python, FastAPI and Pydantic. It is working OK. But the model file create _id with uuid instead of Mongo ObjectId. id: uuid.UUID = Field(default_factory=uuid....
raju's user avatar
  • 6,514
0 votes
0 answers
16 views

Sqlalchemy automatically deletes objects in list

I'm writing simple app using FastAPI and SqlAlchemy. I have written function to get a list of users: async def get_users( db: sqlalchemy.ext.AsyncSession, start_id: int = ..., ...
Minuta18's user avatar
0 votes
0 answers
20 views

FASTAPI SQLAlchemy PSQL How to Post data with relationships

migrations src src/__pycache__ src/auth src/auth/__pycache__ src/auth/base_config.py src/auth/manager.py > incapsulated funcs like create src/auth/models.py > user src/auth/schemas.py > ...
petechka's user avatar
1 vote
2 answers
54 views

How to change authenticated error message in FastAPI?

Can I change 'authenticated' error message in FastAPI? For example, in my login section, the current error message is: { "detail": "Not authenticated" } and I want to change the ...
Arash3f's user avatar
  • 21
1 vote
1 answer
31 views

How to create a pytest fixture to clean a database

I'm working on a Python project with FastAPI and Pony ORM. We're creating unit tests for each module of the program, and we want to be able to run all the tests together (there's one test file for ...
Adolfo Banchio's user avatar
1 vote
1 answer
21 views

Strawberry-FastAPI: How to call the right function?

I'm implementing a variation of the file upload in this tutorial: https://strawberry.rocks/docs/guides/file-upload The code is basically this: import typing import strawberry from strawberry....
easythrees's user avatar
  • 1,554
1 vote
1 answer
38 views

DVC Error comes when Fast API executing through IIS

Error occurred while reading WSGI handler: Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\appdirs.py", line 481, in _get_win_folder_with_pywin32 ...
Sachin G's user avatar
0 votes
0 answers
29 views

FastAPI Endpoint Returning Empty Data

I am working on a FastAPI endpoint (/all) that is supposed to fetch data from a database and return it in response. However, I am encountering an issue where the response data is very less compared to ...
Nilesh's user avatar
  • 1
-1 votes
0 answers
64 views

Response from `PATCH` request in a Docker container never making it to the requesting client

Update: Fixed, but still curious why the problem happened... I found that the problem (described below) was resolved when I didn't specify a port, rather just used the default 8000 from Uvicorn. Here ...
Zachary Duvall's user avatar
-1 votes
0 answers
43 views

ImportError: cannot import name 'Request' from 'fastapi' when run fastapi project using uvicorn

I am facing this error, when I try to run my fast api project using uvicorn. Evertyhing was okay, suddenly I tried to run application, it occurs. I do not understand why this occured. I find same ...
Anar Ahmad's user avatar
0 votes
2 answers
24 views

How to specify version of module installed from git repo with pip install -r requirements.txt

In my Python FastAPI app, I need Pydantic version 2 to solve an issue with Unions that is fixed in version 2 only. Since FastAPI version 0.100.0 and onward supports Pydantic v2, I was first hopeful ...
Mr. Developerdude's user avatar
0 votes
0 answers
13 views

parsing the object from a file upload in Strawberry-FastAPI

I am following this tutorial on Strawberry and FastAPI on managing uploaded files (I need to read a file of a specific format). This is the tutorial: import typing import strawberry from strawberry....
easythrees's user avatar
  • 1,554
0 votes
0 answers
21 views

Implemented FastApi auto documentation behind authentication, but only the authentication endpoints are being documented

I implemented my endpoints documentation behind authentication using basic auth, based on @EasonC13 in the link, only using two other functions to query my database and other one to compare password ...
ivaldir's user avatar
0 votes
0 answers
26 views

422 (Unprocessable Entity) When using axios to send file to fastapi

handle submit function: const handleSubmit = async (acceptedFiles) => { const formData = new FormData(); formData.append("file", file); try { const response = await ...
Parasite -'s user avatar
0 votes
0 answers
16 views

How to exclude existing table of db from alembic without stating a every single table in include_object(func) in env.py. Is there any automated way

I have written every single table in IGNORE_TABLES to exclude the table from alembic revision --autogenerate, didn't found any automated solution, which auto detects the tables not included in ...
harry jame's user avatar
0 votes
0 answers
41 views

How can I use FastApi through IIS using httpPlatformHandler

I am having some issues trying to get a Python 3.7 FastAPI working through IIS. Following instructions to configure Microsoft httpPlatformHandler, I have managed to get a basic response working ...
Simon Pratt's user avatar
1 vote
1 answer
44 views

How to create a relation between a SQLAlchemy model and a table with no model

I am working on micro-services, the base service is in Django and other services are in FastAPI. All the services will share the same PostgreSQL database, the Employee model is in Django and and I ...
harry jame's user avatar
0 votes
1 answer
33 views

Can't convert response from Sqlalchemy to Pydantic model

I'm trying to return a schema that inherits from Pydantic's BaseModel but I'm getting an error Models: class Project(Base): __tablename__ = 'projects' id: Mapped[int] = mapped_column(...
rakhovetski's user avatar
0 votes
0 answers
11 views

reportMissingImport error when using FastAPI even when venv activated, pip installed and right interpreter selected

So I am trying to build my backend application using FastAPI, and first it was working. I activated my venv and pip installed everything and perfect. I kinda remember that I closed my VS code and ...
Henry Song's user avatar
0 votes
0 answers
21 views

importing requests module throws error in FastAPI application

I'm using Python3.8, creating a FastAPI application and trying to import requests module. This throws error "ModuleNotFoundError: No module named 'requests'" However, in the Python terminal, ...
di_gupt10's user avatar
  • 154
0 votes
1 answer
24 views

Gradio HTML component display mounted on FAST API

I am trying to achieve HTML display message on webpage using gradio mounted on fastapi. import gradio as gr from fastapi import FastAPI from starlette.middleware.sessions import SessionMiddleware ...
Shubhank Gupta's user avatar
0 votes
1 answer
28 views

python logging: replace values in dictconfig file using environment variables

I am running a FastAPI app using uvicorn as server. To use less code as possible and to use tools that my environment already provides, I am passing logging configuration to uvicorn using the shell ...
Christian Sicari's user avatar
3 votes
0 answers
56 views

How to protect /docs endpoint in FastAPI using Azure AD (fastapi_msal)?

How to connect the Authorize button in protect under /docs endpoint in FastAPI application to Azure AD? Is it possible to make Authorize button to trigger a popup for the sign in window? Similar to ...
starking's user avatar
  • 183
0 votes
0 answers
27 views

FastAPI: how to return JSONResponse and StreamingResponse

Is it possible to return both a json and a zip file at the same time with FastAPI ? This is the tentative endpoint but it doesn't work: @app.post("/search") async def structure_search() ...
Gabriel Cretin's user avatar
-2 votes
0 answers
29 views

I present an error when I try to decrypt the password using cryptography.fernet [closed]

This code is for a login with a local database with SQL. I already verify that the password that I get from the database is the correct one, the error keeps appearing at the line: if f.decrypt(...
Tomás Lopera's user avatar
1 vote
0 answers
39 views

How to do sorting with multiple column using Edge DB

I'm stuck in EdgeDB query, one of my project's functionality is sort data by multiple columns. I would like to be able to specify any column, such as URL, createdDate, createdBy or any other column ...
Sneh Panara's user avatar
1 vote
0 answers
27 views

Gradio pop up display on success

Here is the below sample code for gradio app mounted on FAST API app. import gradio as gr from fastapi import FastAPI from starlette.responses import RedirectResponse from starlette.requests import ...
Shubhank Gupta's user avatar
0 votes
2 answers
47 views

Unable to connect to GCP cloud SQL from FAST API container using unix_socket

Running the FAST API image is throwing the following error. pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on None") I am using databases for async operations with '...
lakshman's user avatar
0 votes
1 answer
36 views

Heroku Deployment: ocrmypdf.exceptions.MissingDependencyError: tesseract

I'm trying to deploy a FastAPI application to Heroku that uses the ocrmypdf package for OCR (Optical Character Recognition). The application works fine locally, but on Heroku, I get a missing ...
Norbert's user avatar
  • 421
1 vote
0 answers
20 views

How to make video FASTAPI Streaming, not returning a whole file?

Please tell me why, when the video is displayed for the first time through the api below, I get in DevTools that I upload all the videos at once (the size of the uploaded object is equal to the size ...
a55le's user avatar
  • 11
-1 votes
0 answers
40 views

CORS error being thrown randomly fast api

I had to switch over to linux from windows for development reasons but as soon as I did that, running the same backend on linux that worked fine on windows started throwing CORS error on some API ...
Tentamens's user avatar
1 vote
1 answer
49 views
+100

psycopg3 pool "connection is closed"

I have set up a decorator to provide my db connection using psycopg3 and I sometimes have it passing a connection that is closed and throwing the following error when I try to use it: the connection ...
Frank Conry's user avatar
  • 2,607

1
2 3 4 5
117