Last active
December 21, 2015 05:38
-
-
Save roskakori/6257929 to your computer and use it in GitHub Desktop.
Download images for "Schlaflos im Ländle" geocache as described at <http://www.geocaching.com/seek/cache_details.aspx?guid=3052c599-c8bb-4bff-a209-7b23b98bdb1c>. To obtain the required images, start the program sometime around 21:45 CET and let it run until 05:30 CET. You can start it earlier or stop it later but then you might have to ignore so…
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
''' | |
Download images for "Schlaflos im Ländle" geocache as described at | |
<http://www.geocaching.com/seek/cache_details.aspx?guid=3052c599-c8bb-4bff-a209-7b23b98bdb1c>. | |
To obtain the required images, start the program sometime around 21:45 CET and let it run | |
until 05:30 CET. You can start it earlier or stop it later but then you might have to ignore | |
some of the images. | |
''' | |
import logging | |
import os | |
import time | |
import urllib2 | |
from contextlib import closing | |
_log = logging.getLogger('schlaflos') | |
def _download_image(): | |
temp_path = os.environ.get('TEMP', os.environ.get('TMPDIR', os.environ.get('TMP'))) | |
target_path = os.path.join(temp_path, time.strftime('schlaflos_%H_%M_%S.jpg')) | |
_log.info('download "%s"', target_path) | |
with closing(urllib2.urlopen('http://www.auwe.at/Bild_Default.jpg')) as stream: | |
with open(target_path, 'wb') as target_file: | |
target_file.write(stream.read()) | |
if __name__ == '__main__': | |
logging.basicConfig(level=logging.INFO) | |
while True: | |
_download_image() | |
time.sleep(30*60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment