Python Requests: Don't wait for request to finish

前端 未结 5 1790
遇见更好的自我
遇见更好的自我 2020-12-05 06:55

In Bash, it is possible to execute a command in the background by appending &. How can I do it in Python?

while True:
    data = raw_input(\         


        
5条回答
  •  清歌不尽
    2020-12-05 07:24

    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
    

提交回复
热议问题