0

How to receive and parse a HTTP incoming request using python?

0

2 Answers 2

1

You can do:

python -m SimpleHTTPServer 8080 

By default it serves the current working directory.

To get an idea of how this is put together/parses the requests or to work out how to build one for your own needs, look at the "SimpleHTTPServer.py" module in the lib directory of your python install.

You could also look at the built in webservers that the web frameworks like django, werkzeug, cherry-py provide. Stackoverflow has quite a few interesting questions.

Sign up to request clarification or add additional context in comments.

Comments

0

There are dozens of solutions for this, of all kinds and flavors.

The most basic would be SimpleHTTPServer mentioned by @davey.

Other options would be:

http://webpy.org/ - simple, lightweight framework

http://www.tornadoweb.org/ - flexible and scalable web server

http://twistedmatrix.com/trac/wiki/TwistedWeb - single-threaded, event-driven server and framework

http://bottle.paws.de/ - single-file server and framework

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.