Why Is My Stdout Interfering With My Webpage In Python?
Solution 1:
Most probably the output of sendp brakes the HTML so bad it shows as text, what you can do is try pass verbose=0 to sendp (if the output is not important), or try other verbose level. if the output of sendp is important to you, you can run it in a separate script with subprocess.Popen and try to format the output so it fit in the HTML page.
edit: ops, someone already answered with almost the same
Solution 2:
As I understand it, sendp
doesn't just echo the package to stdout; it sends it "down the wire" at a lower protocol level. So if you want to send an html header you'll need to wrap it inside a package, not the other way around.
But are you sure you need to mess with scapy? If all you want is to send POST requests to a webserver, you can just use urllib2.urlopen
. Put your POST data in the optional data
argument, and it will use POST instead of GET for the request.
Solution 3:
It doesn't appear that you are sending http data(eg Response Headers).
You should be because it is being run off a web server.
Post a Comment for "Why Is My Stdout Interfering With My Webpage In Python?"