简体   繁体   中英

Python check status of URL stream

I'm trying to use python to check if a MJPEG stream url is alive or not.

I've tried the following:

 connection = urlopen('http://localhost/videostream.cgi'), timeout=10)
 response = connection.getcode()
 connection.close()

With no luck, it just times out of gives an error.

If I view the status in a firebug or chrome dev toolbar, the status is always "Pending" instead of "200".

Is there a way to check to make sure it's not a 404 or other error?

Cheers, Ben

原来是我的相机Web服务器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM