Questions tagged [starlette]

Questions about Starlette (a lightweight python ASGI framework/toolkit).

Starlette is a lightweight ASGI framework/toolkit, which is ideal for building high performance asyncio services.

https://www.starlette.io

259 questions
1
vote
1 answer

Starlette FormData only provides names of files but not actual files

Trying to upload multiple files through a dynamic HTML form using FastAPI. Server-side, the form comes through okay (as type starlette.datastructures.FormData) but the files are not coming through. all i can see are the filenames as strings. As per…
Alvin Wanda
  • 179
  • 2
  • 9
1
vote
0 answers

Pyinstaller package not found even after a explicit hidden import (gino-starlette)

I've been trying to package an application which requires gino-starlette. I've tried including the requirement as a hidden import with command pyinstaller --hidden-import gino_starlette --hidden-import gino.ext --noconfirm windows_runner.py…
1
vote
0 answers

How to get Starlette Python agent to send logs to elastic APM server from a service running on AWS lamba?

I have a Python program which uses the Starlette framework to send logs to an elastic APM server which is already running. When I test this program from my localhost, it logs transactions in elastic APM. When I run it from an AWS lambda, I do not…
1
vote
2 answers

Inject additional parameter in request using FastAPI

I'm creating an API gateway using fastAPI for some microservices, which in I authenticate user via Azure AD via fastapi-azure-auth. So I'm trying to take out the user info from the request object (request.state.user) and inject my own token in it to…
Ghasem
  • 14,455
  • 21
  • 138
  • 171
1
vote
0 answers

ImportError: cannot import name 'ResolveInfo' from 'graphql

when I ran my main.py file I got ImportError: cannot import name 'ResolveInfo' from 'graphql' (/Users/apple/.local/share/virtualenvs/pythonProject-CGqZmG8Q/lib/python3.9/site-packages/graphql/__init__.py) However, I am trying to install the…
Ali Husham
  • 816
  • 10
  • 31
1
vote
1 answer

How to configure uvicorn in nginx for justpy

I have an extremely simple flask app that works perfectly with gunicorn and nginx over https with a domain. This shows me that all other configurations are working (IP, ports, https, etc.), but when I try and use it with the justpy library, which…
Jason Jurotich
  • 441
  • 4
  • 24
1
vote
0 answers

Fastapi. How to get request.body from starlette-context plugin?

I am using fastapi to build website and I want to get request.body() for logging. I import starlette-context==0.3.3 to get a global context from request. Since the default plugin could only get variable from request.header, I need to write a plugin…
Xing Liu
  • 11
  • 2
1
vote
1 answer

Is there a way to cancel the start depending on a condition with FastAPI startup event?

What I want to do is check a condition on startup event and if execption occurs do not start server or stop server. @app.on_event("startup") def startup_event(): public_key = None try: with open(PUBLIC_KEY_FILE) as…
Ömer Alkin
  • 163
  • 3
  • 17
1
vote
0 answers

Configure Fastapi router

I have declared router in coupe with middleware and added the generic handler for any exception that may happen inside addressing calls to some abstract endpoints: app =…
yose93
  • 75
  • 2
  • 8
1
vote
1 answer

Starlette - uvicorn - graphene exception logging

I use graphene application in starlette on uvicorn. I would like to see exceptions logs with traceroute. But at the moment it hides exceptions and I see only access log with "Bad request" message. I've redirected all loggers I know to the root…
Роман Коптев
  • 1,555
  • 1
  • 13
  • 35
1
vote
1 answer

Uvicorn + Gunicorn + Starlette is getting stuck when serving, can't restart the service without sigkill

I am serving a model on a VM through gunicorn + uvicorn. It is automatically started by supervisord, running api.sh. api.sh contains: source /home/asd/.virtual_envs/myproject/bin/activate /home/asd/.virtual_envs/myproject/bin/gunicorn…
1
vote
1 answer

Authlib's Azure login throws an invalid_claim: Invalid claim "iss"

I am currently login with Google with no problems, using Authlib for my Starlette app, but Azure throws this invalid claim "iss" error when doing: await client.parse_id_token(request, token) Please, any help will be wonderful. Googling it I didn't…
mavaras
  • 53
  • 5
1
vote
1 answer

FastAPI & GINO can't get all rows from table in db

I am stuck into a problem with GINO. I can get a one row from my table called templates, so in the other route i want to get all rows from table. Here you can see my view for get one record from db ant it works…
Lilly
  • 59
  • 1
  • 1
  • 9
1
vote
1 answer

Union type cannot resolve Object Type at Runtime

I am setting up a GraphQL Server with Python using Starlette and Graphene and ran into a problem I cannot find a solution for. The Graphene Documentation does not go into detail regarding the union type, which I am trying to implement. I set up a…
jmandt
  • 386
  • 5
  • 13
1
vote
0 answers

Python Starlette Long Running Job

I want to add a long running job upon starting the server see below for my current implementation. async def start_job(): await long_job() async def long_job(): await task() await asyncio.sleep(settings.SLEEP) app = Starlette( …