Python3 自带的 http.server 模块能接收客户端的 http get 请求,再发送一个 post 请求吗? - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
leafonsword

Python3 自带的 http.server 模块能接收客户端的 http get 请求,再发送一个 post 请求吗?

  •  
  •   leafonsword
    leafonsword Jul 7, 2017 7435 views
    This topic created in 3231 days ago, the information mentioned may be changed or developed.

    我想写个简单程序监听客户端的 http 请求,然后返回一个结果给客户端,请大家帮看下如下思路是否正确:

    1.用 Python3 自带的 http.server 来监听
    2.客户端用 http get 方法来获取
    3.本机程序返回结果用 http post 方法返回给客户端

    Supplement 1    Jul 7, 2017

    看了这篇文章发现http.server模块是可以实现的:
    https://daanlenaerts.com/blog/2015/06/03/create-a-simple-http-server-with-python-3/

    9 replies    2017-07-07 13:06:08 +08:00
    LokiSharp
        1
    LokiSharp  
       Jul 7, 2017
    EchoUtopia
        2
    EchoUtopia  
       Jul 7, 2017 via iPhone   1
    http 响应没有 post、get 这一说吧
    awanabe
        3
    awanabe  
       Jul 7, 2017
    发送请求你需要 requests 库。
    你要发送给客户端 post 请求是为啥? 那客户端还要起一个 server 监听。 直接用 get 请求的 response 不就好了么
    Morriaty
        4
    Morriaty  
       Jul 7, 2017
    你应该先看一下 http 原理.......
    21grams
        5
    21grams  
       Jul 7, 2017   1
    返回 post 给客户端? 你知道你在说什么吗?
    ghostheaven
        6
    ghostheaven  
       Jul 7, 2017 via Android
    WuMingyu
        7
    WuMingyu  
       Jul 7, 2017 via iPhone
    ,,,,,,,,,,,,,,
    wilsonwen
        8
    wilsonwen  
       Jul 7, 2017 via Android
    可以,把 http 协议重写就行了
    zoues
        9
    zoues  
       Jul 7, 2017 via iPhone
    可以告别 cs 了
    About     Help     Advertise     Blog     API     FAQ     Solana     3437 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 43ms UTC 12:11 PVG 20:11 LAX 05:11 JFK 08:11
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86