Parse HTTP header using Python and tcpflow
New Lines and indentations help the interpreter know where the code terminates and blocks end, you have to be super careful with them  

Like in your if condition, you can't have a newline in between the conditions.

if header.find(" ")==0 or 
    header.find("\t")==0:
    continue


This code will error out because you can't have a new line in your condition statement.

Python is New Line Terminated.  It should read like this

if header.find(" ")==0 or header.find("\t")==0
    continue


Same with this piece of code

while headers[i].find(" ")==0 or  
    headers[i].find("\t")==0 :
    fields[key]=fields[key]+" "+headers[i].strip()
    i=i+1


It should read:

while headers[i].find(" ")==0 or headers[i].find("\t")==0 :
    fields[key]=fields[key]+" "+headers[i].strip()
    i=i+1