473,783 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing POST parameters from BaseHTTPServer

Hi all,
I'm writing a super simple little debugging HTTP server which simply
returns the path and parameters it receives requests for.

E.g. requesting /meth?a=b returns something like:
Command: GET
Path: /meth
Params: {'a': ['b']}

This is fine for GET, but I can't see how I access parameters passed
by POST requests...

The particular client programme I'm testing will be passing stuff up
as text/xml, if that's any help...

Thanks!
James
Nov 6 '08 #1
1 3829
James wrote:
Hi all,
I'm writing a super simple little debugging HTTP server which simply
returns the path and parameters it receives requests for.

E.g. requesting /meth?a=b returns something like:
Command: GET
Path: /meth
Params: {'a': ['b']}

This is fine for GET, but I can't see how I access parameters passed
by POST requests...

The particular client programme I'm testing will be passing stuff up
as text/xml, if that's any help...
You read the standard input and decode them according to the relevant
RFC. The source of the cgi module could be enlightening there. You might
even consider importing it and using it ...

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Nov 7 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1871
by: Molly | last post by:
Peace, Pythonphiles! Python's std lib BaseHTTPServer: I'm stuck with a nasty spoiler -- I get erratic "Network error: disconnected by peer" for _POST_ requests only. =Background= I'm developing a Python CGI app. Was using Xitami, which is really light and nice, reasonable performance (circa 200-300 msec to respond,
0
2013
by: Joshua W. Biagio | last post by:
Hello all, I am having difficulty getting the HTTP/1.1 support (i.e. pipelining and persistent connections) for the BaseHTTPServer library to work. When I change the line for the protocol in BaseHTTPServer from "HTTP/1.0" to "HTTP/1.1", the SimpleHTTPServer program can still serve directory listings and even graphics files, but it hangs when I try to browse to an HTML file. I have a directory of web pages that I use to test servers (such as...
1
1895
by: Yin | last post by:
Hello. I am using the basehttpserver to implement the HTTP protocol to serve a fairly large lexicon that I have loaded as a dictionary in python. Rather than writing a whole server, I would like to reuse the BaseHTTPserver classes. I am interested in finding a way to serve the dict without loading the whole dict into memory everytime an HTTP request is made. The dict lives in local memory when it is loaded and takes a long time to load.
0
999
by: Jeff Gercken | last post by:
I want my http server to return a default form, regardless of the GET request, but I'm a bit of a noob and have no idea how. I'm trying to write a platform-independent captured portal for my wireless AP. This is what I have: #!/usr/bin/env python import CGIHTTPServer import BaseHTTPServer class ServerHandler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories=
0
1354
by: Ron Garret | last post by:
I'm write a web server using BaseHTTPServer. It can't be a CGI because it has to do some weird server-push stuff as database updates come in. But I still need to process form inputs as if it were a CGI. But the cgi module only works in a CGI environment. Is there something with the equivalent functionality of cgi.FieldStorage for parsing form input in a non-CGI environment such as a BaseHTTPServer? I looked at the cgi module code but...
0
1993
by: guddi1 | last post by:
Hi, I am looking to figure out how to display parameters of a post request. I am working in visual C++ environment. I have a program that tracks and outputs URL activity. For instance, when I log in to my yahoo email account, the program outputs the following headers: (Request for https://login.yahoo.com/config/login?) POST /config/login? HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash,...
2
3704
by: Vlad Dogaru | last post by:
Hello, After experimenting for a while, I am still not able to find where the POST data is in the BaseHTTPRequestHandler class. I am trying to write a very simple HTTP server for a project of mine and I need to get the POST data. Certainly I am missing something, as it is a comon task. Thanks in advance, Vlad
3
2404
by: Ron Garret | last post by:
I have a fairly large web app written in Python as a CGI fairly elaborate CGI. All of the requests go through a single CGI script which does authentication and session management and then dispatches to one of a number of handlers that generate the various pages. There is one page that is a performance bottleneck (because it is accessed automatically once a second by an XMLHTTPRequest, but that's another story). I have fixed this by...
0
1090
by: samwyse | last post by:
I've just now submitted two issues to the issue tracker: 1491 BaseHTTPServer incorrectly implements response code 100 RFC 2616 sec 8.2.3 states, "An origin server that sends a 100 (Continue) response MUST ultimately send a final status code, once the request body is received and processed, unless it terminates the transport connection prematurely." The obvious way to do this is to invoke the 'send_response' method twice, once with...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.