Created
February 25, 2010 15:54
-
-
Save nsmgr8/314658 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
import datetime | |
import time | |
import urllib2 | |
def getcsv(se): | |
response = urllib2.urlopen('http://dsecse.latest.nsmgr8.appspot.com/'+se) | |
fname = response.headers['content-disposition'] | |
fname = os.path.join(se, fname[fname.find(se):-1]).replace(':', '-') | |
if not os.path.isdir(se): | |
os.mkdir(se) | |
with open(fname, 'w') as f: | |
f.write(response.read()) | |
response.close() | |
print('fetched %s' % fname) | |
if __name__ == '__main__': | |
while True: | |
for se in ['dse', 'cse']: | |
try: | |
getcsv(se) | |
except Exception, e: | |
print('There was an error for %s: %s' % (se, e)) | |
print('waiting at %s' % datetime.datetime.now()) | |
time.sleep(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment