1 Replies - 149 Views - Last Post: 22 August 2014 - 08:42 AM Rate Topic: -----

#1 code_m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 24
  • View blog
  • Posts: 202
  • Joined: 21-April 09

Which library to use to make a servlet like program?

Posted 22 August 2014 - 07:48 AM

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 :)

Is This A Good Question/Topic? 0
  • +

Replies To: Which library to use to make a servlet like program?

#2 fryishone  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 53
  • Joined: 09-May 14

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?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1