473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

BaseHTTPServer module

>From the BaseHTTPServer module, how do i gget the POST or GET data sent
by the client? Is it stired the the file they requested? e.g.
objectname.path

Nov 22 '05 #1
4 3538
"amfr" <am******@gmail.com> wrote:
From the BaseHTTPServer module, how do i gget the POST or GET data sent

by the client? Is it stired the the file they requested? e.g.
objectname.path


Did you check the documentation in the module? You need to derive your own
class from BaseHTTPServer. In that module, you need to add functions
called do_GET and do_POST.

In a GET request, the data is all encoded in the URL. You'll find that in
self.path.

In a POST request, the data is all encoded in the body of the request.
You'll find that in self.rfile. You'll have to parse and decode it
yourself.

However, as the module documentation also tells you, that has already been
done for you in SimpleHTTPServer.py.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 22 '05 #2
"amfr" <am******@gmail.com> wrote:
From the BaseHTTPServer module, how do i gget the POST or GET data sent

by the client? Is it stired the the file they requested? e.g.
objectname.path


Did you check the documentation in the module? You need to derive your own
class from BaseHTTPServer. In that module, you need to add functions
called do_GET and do_POST.

In a GET request, the data is all encoded in the URL. You'll find that in
self.path.

In a POST request, the data is all encoded in the body of the request.
You'll find that in self.rfile. You'll have to parse and decode it
yourself.

However, as the module documentation also tells you, that has already been
done for you in SimpleHTTPServer.py.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 22 '05 #3
I looked at the doumentation and is says rfile is:
"Contains an input stream, positioned at the start of the optional
input data."
How do i get the input out of it?

Dec 1 '05 #4
amfr wrote:
I looked at the doumentation and is says rfile is:
"Contains an input stream, positioned at the start of the optional
input data."
How do i get the input out of it?


As with any "input stream" (file-like object) in Python, you call file
methods like .read() or maybe .readline() and others.

-Peter

Dec 1 '05 #5

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

Similar topics

1
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...
2
by: Simon Wittber | last post by:
BaseHTTPServer uses the mimetools module, which is deprecated. Are the maintainers of modules that are in the standard library listed somewhere? Who could/should I send patches to? Also, does...
2
by: Andy Leszczynski | last post by:
Does BaseHTTPServer.BaseHTTPRequestHandler support HTTP protocol chunking? Thanks, Andy
1
by: Adam Atlas | last post by:
Is there any built-in way for BaseHTTPServer to handle multiple connections at once, e.g. with threads? If not, can this existing module be easily extended to do this, or will I have to do...
0
by: amfr | last post by:
>From the BaseHTTPServer module, how do i gget the POST or GET data sent by the client? Is it stired the the file they requested? e.g. objectname.path
0
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...
13
by: Ron Garret | last post by:
I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: ================================= #!/usr/bin/python from BaseHTTPServer import * import cgi
3
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...
4
by: sebsauvage | last post by:
Hello. I'm using SimpleHTTPServer (work well) but it always sends "Server" header in response: "Server: SimpleHTTP/0.6 Python/2.5.1" How can I remove that ? I tried:
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.