开发者

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

开发者 https://www.devze.com 2023-01-11 20:55 出处:网络
How to receive and parse a HTTP incoming reque开发者_如何学Gost using python?You can do: python -m SimpleHTTPServer 8080

How to receive and parse a HTTP incoming reque开发者_如何学Gost using python?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号