SHARE
TWEET

reddit question 003

a guest Oct 20th, 2012 47 Never
  1. import time
  2. import datetime
  3. import urllib
  4. import re
  5. #from BeautifulSoup import BeautifulSoup
  6. #import smtp
  7.  
  8. def pollArduinoFileIndex(delayTime):
  9.     dataTimestamp = datetime.datetime.strftime(datetime.datetime.now(), "%Y%m%d_%H%M%S")
  10.         #dataTimestamp = str(dataTimestamp)
  11.     urllib.urlretrieve ("http://xxx.xxx.xx.xx:yyy/", "urlIndex.html")
  12.     dataFile = open('urlIndex.html', 'r')
  13.     data = dataFile.read()
  14.     fileIndex = re.findall('DATA.*?\.CSV', data)
  15.     #print fileIndex
  16.     for file in fileIndex:
  17.         #print file
  18.         url = ('http://xxx.xxx.xx.xx:xxx/%s' % file)
  19.         #print url
  20.         urllib.urlretrieve (url, '/Users/xxx/Documents/xxx/20121019/%s' % file)
  21.         print "."
  22.     print("url retrieve done")
  23.     time.sleep(delayTime)
  24.        
  25. pollArduinoFileIndex(1)
RAW Paste Data
Top