How to implement Timeout in BaseHTTPServer.BaseHTTPRequestHandler Python

前端 未结 7 1401
走了就别回头了
走了就别回头了 2021-01-19 01:46

In my python script, I am trying to run a web server:

server = BaseHTTPServer.HTTPServer((\'127.0.0.1\',8080), RequestHandler)

I have a req

7条回答
  •  Happy的楠姐
    2021-01-19 02:13

    I managed to get timeouts working for HTTP requests with

    self.rfile._sock.settimeout(60)
    

    Hope this helps

提交回复
热议问题