fastapi

issue with cross-site cookies: how to set cookie from backend to frontend

。_饼干妹妹 提交于 2021-01-02 06:09:11
问题 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, and display the results. I've been having problems with cookies, and I'd like help. Apologies in advance for the long post – I've been going through many resources past couple of days, and at this point I'm unsure what's relevant and what's not. Frontend on localhost:8080 Backend on http://127.0.0.1

Cloud Run - Requests latency

时间秒杀一切 提交于 2021-01-01 09:10:36
问题 I am trying to use Cloud Run to run a microservice connected to Firestore. The microservice creates objects based on s2geometry to create multiple geographical zones with specific attributes and thus help localizing users to send them information according to the zone I locate them in. I used Python 3.7 and FastAPI to create the microservice and the routes to communicate with it. The microservice runs smoothly on my local machine and on Compute Engines as most of my routes takes less than 150

Cloud Run - Requests latency

ぐ巨炮叔叔 提交于 2021-01-01 09:10:10
问题 I am trying to use Cloud Run to run a microservice connected to Firestore. The microservice creates objects based on s2geometry to create multiple geographical zones with specific attributes and thus help localizing users to send them information according to the zone I locate them in. I used Python 3.7 and FastAPI to create the microservice and the routes to communicate with it. The microservice runs smoothly on my local machine and on Compute Engines as most of my routes takes less than 150

Cloud Run - Requests latency

一笑奈何 提交于 2021-01-01 09:09:39
问题 I am trying to use Cloud Run to run a microservice connected to Firestore. The microservice creates objects based on s2geometry to create multiple geographical zones with specific attributes and thus help localizing users to send them information according to the zone I locate them in. I used Python 3.7 and FastAPI to create the microservice and the routes to communicate with it. The microservice runs smoothly on my local machine and on Compute Engines as most of my routes takes less than 150

How to do multiprocessing in FastAPI

99封情书 提交于 2020-11-28 07:58:50
问题 While serving a FastAPI request, I have a CPU-bound task to do on every element of a list. I'd like to do this processing on multiple CPU cores. What's the proper way to do this within FastAPI? Can I use the standard multiprocessing module? All the tutorials/questions I found so far only cover I/O-bound tasks like web requests. 回答1: TL;DR You could use loop.run_in_executor with ProcessPoolExecutor to start function at a separate process. loop = asyncio.get_event_loop() with concurrent.futures