Skip to content

Instantly share code, notes, and snippets.

@nsmgr8
Created February 25, 2010 15:54
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 nsmgr8/314658 to your computer and use it in GitHub Desktop.
Save nsmgr8/314658 to your computer and use it in GitHub Desktop.
#!/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