1

I have a remote client that does POST messages at regular intervals. I want my server process to be able to listen to these POST messages and dump the data to a file. The data posted by the remote client are all JSON documents. Can I write a simple listening server using python requests package rather than using any standard web server.

liv2hak
  • 14,472
  • 53
  • 157
  • 270
  • 1
    nope, need to use a web app package (I'd say flask) for this. `requests` is made for making requests, not for receiving them. – reptilicus Apr 28 '15 at 02:20
  • You could use [BaseHTTPServer](https://docs.python.org/2/library/basehttpserver.html) module, it is already pre-installed. – Electron Apr 28 '15 at 02:37
  • From there, you could either define your own handler, or make a CGI script. Refer to my previous answer: http://stackoverflow.com/questions/23586713/run-python-application-from-browser/23588317#23588317 – Electron Apr 28 '15 at 02:40
  • Yes you can, look at this answer, this answer will help you; http://stackoverflow.com/questions/31371166/reading-json-from-simplehttpserver-post-data – Sezer BOZKIR Mar 27 '17 at 09:22

0 Answers0