1

I would like to track the usage of my Flask API. Therefore I send a request to my tracking API before every request:

@app.before_request
def track():
    requests.get("...")
    ...

Sometimes the request takes several seconds and the user of my API has to wait until it finished too. Now I'd like to call the request without waiting for it to finish.

I tried grequests. Unfortunately there is no way to get the response of the request to the analytics API. Should I use threading or something else.

Sometimes there are many requests to my API. So the task should not crash flask if there are many requests at the same time.

I would appreciate an answer.

William M.
  • 369
  • 1
  • 5
  • 10

0 Answers0