Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Requests.get() in dash threaded issue

$
0
0

Hello community,

I’m running a Dash app embedded in flask server using this line :

app = dash.Dash(__name__,,suppress_callback_exceptions=True,server=app_flask)

I have multiple callbacks in separates which uses http requests in parralel with differents urls, :

File1

    @app.callback(Output('myoutput_id','myoutput'),Input('url_id','href'))
    def createDf1(url):
        data1 = requests.get(url)
        # then here I use my data to create a specific dataframe and return it

File2

    @app.callback(Output('myoutput2_id','myoutput'),Input('url2_id','href'))
    def createDf2(url2):
        data2 = requests.get(url2)
        # then here I use my data to create a specific dataframe and return it
        

I read that now the default behavior of dash is with the threaded = true …

My problem is when I make more than 3 or 4 get requests based on the previous example I see that the thread which was launched by the first callback return the value of the second requests.get() or the third one randomly.

Is there a way to make sure that the requests.get result match with the callback sender ?

I really hope that someone could help me :innocent:

Thank’s

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images