How to return plain text or JSON depending on condition?
Is there a way to do something like this using FastAPI:
How to check if at least one of multiple dependencies passes in Fastapi
I have an endpoint that should work for two separate groups of users and I would like to give a proper error message if user is not part of either group. For these groups I have created dependencies that I also use in other endpoints:
Fastapi_users. AttributeError: module ‘jwt’ has no attribute ‘encode’
Here is my github: https://github.com/klukashka/Calendar
I run my code locally with uvicorn main:app --reload
and go to http://127.0.0.1:8000/docs. Then I register and everything works properly (I see a new row in postgres database). After that I want to login but catch such an error.
FastAPI Why i get Unsupported upgrade request with DELETE request?
I have written a fastapi backend.
To keep the code clean I wanted to uninstall everything that was installed via pip during development and then only install the most necessary. After I did that, one endpoint doesn’t seem to work anymore.
Am I missing something in running a process in FastAPI with uvicorn?
When I run this code locally:
Is it correct to create a new instance of sqlalchemy engine for each request?
I started to develop a bigger application that needs persistance.
Bulk insert into SQL Server from python
I have a FastAPI endpoint in python that needs to insert a few thousand rows into a SQL Server table. I have the data in a pandas dataframe and currently I’m looping over the dataframe and inserting them individually. Is there a way to do a bulk insert as this process is timing out the endpoint as it takes too long. I can’t use SQLalchemy as the FastAPI script is on an Azure server and SQLalchemy crashes the server.
How does object instanciation works in python?
I am learning python by implementing a website with fastApi ; I have many years of experience in C#. I have this code :
FastAPI no module named “my module” – FastAPI cannot find my Python Package
FastAPI cannot find my Python Package. It seems relatively obvious that this is an issue with Python paths and imports, however I do not know how to fix it.
How to understand the callback mechanism of fastapi?
How to understand the callback mechanism of fastapi? The official document gives the following example