Download .jpg from web

GMane Python s_david_rose at hotmail.com
Thu Jan 6 13:49:07 EST 2005


Hello All.
  Using a network camera with built-in webserver, I'd like to have a python
program download .jpg files on a local lan.  the location is
http://<ip-address>/jpg/image.jpg.

  Currently, I'm importing urllib and using urlopen to the address, then
read()-ing it, saving it to a binary file.  All that is working great, but
maybe a bit slowly.  I'm getting ~2.3 frames per second, and would like
between 5-10 frames per second.

  Am I approaching this incorrectly?  I have to do a urlopen, then .read()
for each image.  Is there any way to 'persist' the urlopen so I just have to
keep read()-ing or maybe is there a type of streaming read?  I have many
cameras, so there are many threads simultaneously reading and dropping them
in a central Queue for saving later.

  I appreciate it!
-Dave

 WebImage = urllib.urlopen("http://<ip-address>/jpg/image.jpg").read()
 QueuePacket = []
 QueuePacket.append(WebImage)







More information about the Python-list mailing list