I am quite new to FastAPI, so I have a question if it is possible to access data within the path operation function, which(data) is stored/generated outside of that function.
Generally, API endpoints look like this:
@app.get('/root'):
def some_function(params):
get_data() # data outside of this function
.... (some processing)
return data
The system, I'm trying to make, consists of two independently operating scripts. And they communicate using MQTT Broker. So, I intend to return data(received from other script) and return it through API endpoint.
Any help would be appreciated.