Python beginner here. I want to be able to timeout my download of a video file if the process takes longer than 500 seconds.
import urllib try: urllib.ur
Although urlretrieve does not have this feature, you can still set the default timeout (in seconds) for all new socket objects.
urlretrieve
import socket import urllib socket.setdefaulttimeout(15) try: urllib.urlretrieve ("http://www.videoURL.mp4", "filename.mp4") except Exception as e: print("error")