Python Requests: Don’t wait for request to finish

Here’s a hacky way to do it:

try:
    requests.get("http://127.0.0.1:8000/test/",timeout=0.0000000001)
except requests.exceptions.ReadTimeout: 
    pass

Edit: for those of you that observed that this will not await a response – that is my understanding of the question “fire and forget… do not wait for it to finish”. There are much more thorough and complete ways to do it with threads or async if you need response context, error handling, etc.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)