Skip to content

Instantly share code, notes, and snippets.

@Seagor
Last active April 7, 2016 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seagor/7d38dcc8a52143ce05cbf10d9d418415 to your computer and use it in GitHub Desktop.
Save Seagor/7d38dcc8a52143ce05cbf10d9d418415 to your computer and use it in GitHub Desktop.
A scraper for fetching images from a webcam
import gevent
import urllib2
image_url = "http://manage.hdrelay.com/snapshot/ee489921-1004-45df-9634-0fa96543dabf?size=710x425&f=30000"
polling_interval = "31"
def stream():
while True:
msg = {"media_url": image_url}
msg["polling_interval"] = float(polling_interval)
msg["media"] = custom_encode(urllib2.urlopen(msg["media_url"]))
yield msg
gevent.sleep(float(polling_interval))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment