Last active
April 7, 2016 02:30
-
-
Save Seagor/7d38dcc8a52143ce05cbf10d9d418415 to your computer and use it in GitHub Desktop.
A scraper for fetching images from a webcam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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