def hunt_for_stacktrace(url):
 req = urlreq.Request(url)
 req.add_header('Accept-Encoding', 'gzip')
 page = urlreq.urlopen(req)
 buf = six.StringIO(page.read())
 f = gzip.GzipFile(fileobj=buf)
 content = f.read()
 traces = []
 trace = StackTrace()
 for line in content.splitlines():
  m = re.match(NOVA_REGEX, line)
  if m:
   data = m.groupdict()
   if (trace.not_none() and trace.is_same(data)):
    trace.append((data['msg'] + '\n'))
   else:
    trace = StackTrace(timestamp=data.get('timestamp'), pid=data.get('pid'), level=data.get('level'), module=data.get('module'), msg=data.get('msg'))
  elif trace.not_none():
   traces.append(trace)
   trace = StackTrace()
 if trace.not_none():
  traces.append(trace)
 return traces

def hunt_for_stacktrace ( url ) : req = urlreq . Request ( url ) req . add_header ( 'Accept-Encoding' , 'gzip' ) page = urlreq . urlopen ( req ) buf = six . StringIO ( page . read ( ) ) f = gzip . GzipFile ( fileobj = buf ) content = f . read ( ) traces = [ ] trace = StackTrace ( ) for line in content . splitlines ( ) : m = re . match ( NOVA_REGEX , line ) if m : data = m . groupdict ( ) if ( trace . not_none ( ) and trace . is_same ( data ) ) : trace . append ( ( data [ 'msg' ] + '\n' ) ) else : trace = StackTrace ( timestamp = data . get ( 'timestamp' ) , pid = data . get ( 'pid' ) , level = data . get ( 'level' ) , module = data . get ( 'module' ) , msg = data . get ( 'msg' ) ) elif trace . not_none ( ) : traces . append ( trace ) trace = StackTrace ( ) if trace . not_none ( ) : traces . append ( trace ) return traces
return trace or error lines out of logs .