D
Dirk Zimmermann
Hi,
I like to do the following: Via http I get a stream of data and I like
to store this data with a python program. So what I need is to start the
downloading and to stop it after a given time. My aproach was to use:
urllib.urlretrieve("ULR","FILENAME")
It is fine! But how to stop the retrieving? Because it is a constant
stream of data there is no natural end. So I thought I use
treading.Thread to do it:
def retr():
urllib.urlretrieve("URL","FILENAME")
t=threading.Thread(target=retr)
t.start()
It's fine! The data is downloaded and I'm back in my program to do some
other stuff. BUT: I cannot stop the download. How can I achieve this?
(Another way of solution (w/o threading) would also helpful, of course!)
Thanks for your help,
Dirk
I like to do the following: Via http I get a stream of data and I like
to store this data with a python program. So what I need is to start the
downloading and to stop it after a given time. My aproach was to use:
urllib.urlretrieve("ULR","FILENAME")
It is fine! But how to stop the retrieving? Because it is a constant
stream of data there is no natural end. So I thought I use
treading.Thread to do it:
def retr():
urllib.urlretrieve("URL","FILENAME")
t=threading.Thread(target=retr)
t.start()
It's fine! The data is downloaded and I'm back in my program to do some
other stuff. BUT: I cannot stop the download. How can I achieve this?
(Another way of solution (w/o threading) would also helpful, of course!)
Thanks for your help,
Dirk