def parse_web_listing(url):
 dirs = []
 files = []
 r = requests.get(url, timeout=3.05)
 if (r.status_code != requests.codes.ok):
  raise Exception(('HTTP Status Code %s' % r.status_code))
 for line in r.content.split('\n'):
  line = line.strip()
  match = re.match('^.*\\<a.+href\\=[\\\'\\"]([^\\\'\\"]+)[\\\'\\"].*\\>.*(\\w{1,4}-\\w{1,4}-\\w{1,4})', line, flags=re.IGNORECASE)
  if match:
   if match.group(1).endswith('/'):
    dirs.append(match.group(1))
   elif match.group(1).lower().endswith(utils.image.SUPPORTED_EXTENSIONS):
    files.append(match.group(1))
 return (dirs, files)

def parse_web_listing ( url ) : dirs = [ ] files = [ ] r = requests . get ( url , timeout = 3.05 ) if ( r . status_code != requests . codes . ok ) : raise Exception ( ( 'HTTP Status Code %s' % r . status_code ) ) for line in r . content . split ( '\n' ) : line = line . strip ( ) match = re . match ( '^.*\\<a.+href\\=[\\\'\\"]([^\\\'\\"]+)[\\\'\\"].*\\>.*(\\w{1,4}-\\w{1,4}-\\w{1,4})' , line , flags = re . IGNORECASE ) if match : if match . group ( 1 ) . endswith ( '/' ) : dirs . append ( match . group ( 1 ) ) elif match . group ( 1 ) . lower ( ) . endswith ( utils . image . SUPPORTED_EXTENSIONS ) : files . append ( match . group ( 1 ) ) return ( dirs , files )
utility for parse_folder() parses an autoindexed folder into directories and files returns .