I want to make a simple program that is able to process POST request like a servlet does in Java. I'm finding all kinds of documentation on how to make a request in python, but that's not what I'm looking to do. I am looking to respond to a custom request.
For example I would like to put http://localhost:808...t.py?data=hello into my browser and have pyservlet.py come up with a response.
I'm aware I could use a cgi script, but it feels old & clunky. I've tried to look into urllib.request, http.client, and http.server, however I'm banging my head against the wall trying to understand which library (or libraries?) I should be using. I've also looked at the third party requests library, does anyone have any opinion on that?
If someone has a simple boiler-plate or hello world example that would be awesome
1 Replies - 222 Views - Last Post: 22 August 2014 - 08:42 AM
Replies To: Which library to use to make a servlet like program?
Re: Which library to use to make a servlet like program?
Posted 22 August 2014 - 08:42 AM
After skimming the links you have provided, the requests package seems like it could be promising. Depending on what your overall goal is, I don't believe it would take long to trial the urllib.request package and the requests third party package. Based on how easy you found it to implement would be your deciding factor?
Page 1 of 1