21.04.13 16:46, Chris Angelico написав(ла):
Also, it's expecting bytes everywhere, and I can't find a simple way
to declare an encoding and let self.wfile.write() accept str. Do I
have to explicitly encode everything that I write, or is there a
cleaner way?
io.TextIOWrapper
--
http://mail.pyt
On Mon, Apr 22, 2013 at 12:01 AM, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> In the current version of the code, I use BaseHTTPServer as the main
>> structure of the request handler. 2to3 translated this into
>> http.server, which seems to be the
In article ,
Chris Angelico wrote:
> In the current version of the code, I use BaseHTTPServer as the main
> structure of the request handler. 2to3 translated this into
> http.server, which seems to be the nearest direct translation. But is
> that the best way to go about making a
, and it's more of an advice one.
In the current version of the code, I use BaseHTTPServer as the main
structure of the request handler. 2to3 translated this into
http.server, which seems to be the nearest direct translation. But is
that the best way to go about making a simple HTTP server?
En Mon, 03 Oct 2011 12:03:18 -0300, amit escribió:
I am really stuck in a very simple problem and wanted to know if you
could take some time to check it out -
My code is simple. Using BaseHTTPServer and ThreadInMix I want to run
a python script (Script1.py) for every request made
Hi everyone,
I am really stuck in a very simple problem and wanted to know if you
could take some time to check it out -
My code is simple. Using BaseHTTPServer and ThreadInMix I want to run
a python script (Script1.py) for every request made simultaneously.
My code->
from subprocess imp
format%args))
>
> httpd = HTTPServer(ADDR, MyLoggingHTTPRequestHandler)
> httpd.serve_forever()
>
> Simon
>
>
>
>
>
>
>
> On Wed, 4 May 2011 03:52:29 -0700 (PDT), LehH Sdsk8 wrote:
> > First, i'm sorry for any inglish error!
>
>
rever()
Simon
On Wed, 4 May 2011 03:52:29 -0700 (PDT), LehH Sdsk8 wrote:
First, i'm sorry for any inglish error!
So, i use the BaseHTTPServer to create a page for monitoring
purposes,
someone now how to direct the event log to a file?
--
http://mail.python.org/mailman/listinfo/python-list
First, i'm sorry for any inglish error!
So, i use the BaseHTTPServer to create a page for monitoring purposes,
someone now how to direct the event log to a file?
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 2010-01-16 at 18:35 -0800, yousay wrote:
> On Jan 13, 1:38 am, Adam Tauno Williams
> wrote:
> > Looking at <http://code.activestate.com/recipes/425210/> and
> > <http://code.activestate.com/recipes/499376/> as examples I've attempted
> > to cre
On Jan 13, 1:38 am, Adam Tauno Williams
wrote:
> Looking at <http://code.activestate.com/recipes/425210/> and
> <http://code.activestate.com/recipes/499376/> as examples I've attempted
> to create a BaseHTTPServer class that times-out accept() ever X seconds
> to
Looking at <http://code.activestate.com/recipes/425210/> and
<http://code.activestate.com/recipes/499376/> as examples I've attempted
to create a BaseHTTPServer class that times-out accept() ever X seconds
to check some other work. This seems to work well, but only once the
HTTP
On Feb 15, 8:46 pm, Steve Holden wrote:
> Paul wrote:
> > Hi,
> > I currently have a webserver using BaseHttpServe that serves images
> > like this:
> > if self.path.endswith(".jpg"):
> > print(curdir + sep + self.path)
> > f = open(curdir + sep + self.path,"b")
> >
Paul wrote:
> Hi,
> I currently have a webserver using BaseHttpServe that serves images
> like this:
> if self.path.endswith(".jpg"):
> print(curdir + sep + self.path)
> f = open(curdir + sep + self.path,"b")
> self.send_response(200)
>
On 15 fév, 18:31, Paul wrote:
> Hi,
> I currently have a webserver using BaseHttpServe that serves images
> like this:
> if self.path.endswith(".jpg"):
> print(curdir + sep + self.path)
> f = open(curdir + sep + self.path,"b")
> self.send_response(20
Hi,
I currently have a webserver using BaseHttpServe that serves images
like this:
if self.path.endswith(".jpg"):
print(curdir + sep + self.path)
f = open(curdir + sep + self.path,"b")
self.send_response(200)
self.send_header('Content-
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
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 pass
#x27;, self.version_string()) in the
send_response method of the BaseHTTPRequestHandler class in the
BaseHTTPServer module. Long story, short, it's going to be a lot of work
to get rid of.
One can always write a customized RequestHandler, and just copy the
send_response method omiting t
you've got ?self.send_header('Server', self.version_string()) in the
send_response method of the BaseHTTPRequestHandler class in the
BaseHTTPServer module. Long story, short, it's going to be a lot of work
to get rid of.
[EMAIL PROTECTED] wrote:
Hello.
I'm using Si
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:
self.server_version = ""
self.sys_version = ""
but the header is still sent, empty.
I there a way to remove the "Server:" head
En Wed, 27 Feb 2008 10:33:35 -0200, rocksportrocker
<[EMAIL PROTECTED]> escribi�:
> Hi,
>
> I am trying to implement a local server for storing and retrieving
> numerical data.
> So I use BaseHTTPServer as follows:
>
> -
If I ommit send_response() in do_POST() I get no
errormessage. That is an acceptable solution for me.
Greetings, Uwe
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 27, 2:50 pm, 7stud <[EMAIL PROTECTED]> wrote:
> ...
> I don't get that error. On the server, I get the output:
>
> POST
> localhost - - [27/Feb/2008 06:49:13] "POST / HTTP/1.1" 200 -
>
> and on the client I get:
>
> None
>
In my case the server says:
Traceback (most recent call last
On Feb 27, 5:33 am, rocksportrocker <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am trying to implement a local server for storing and retrieving
> numerical data.
> So I use BaseHTTPServer as follows:
>
> -----
>
On Feb 27, 1:28 pm, rocksportrocker <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am trying to implement a local server for storing and retrieving
> numerical data.
> So I used BaseHTTPServer as follows:
>
> from BaseHTTPServer import *
>
> class Handler(BaseHTTPRequestH
Hi,
I am trying to implement a local server for storing and retrieving
numerical data.
So I use BaseHTTPServer as follows:
-
from BaseHTTPServer import *
class Handler(BaseHTTPRequestHandler):
def do_POST(self
Hi,
I am trying to implement a local server for storing and retrieving
numerical data.
So I used BaseHTTPServer as follows:
from BaseHTTPServer import *
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
print "POST"
self.send_response(200)
httpd =
I've just now submitted two issues to the issue tracker:
1491BaseHTTPServer 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
> Does
> > > anyone know of a straightforward way to get Apache to "forward" requests
> > > to a given path to another HTTP server running on a different port?
> >
> > Never mind, I think I figured it out. Apparently what I need is the
> > ProxyPassRever
path to another HTTP server running on a different port?
>
> Never mind, I think I figured it out. Apparently what I need is the
> ProxyPassReverse directive.
>
> I'd still be interested in hearing about people's experience using
> BaseHTTPServer for real applications.
>
Apparently what I need is the
ProxyPassReverse directive.
I'd still be interested in hearing about people's experience using
BaseHTTPServer for real applications.
Thanks,
rg
--
http://mail.python.org/mailman/listinfo/python-list
performance bottleneck (because it is
accessed automatically once a second by an XMLHTTPRequest, but that's
another story). I have fixed this by re-implementing that page using a
BaseHTTPServer. So I can fix my problem by redirecting the
XMLHTTPRequest to a URL that is served by
Vlad Dogaru wrote:
> 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 com
Vlad Dogaru wrote:
>
> 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 co
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
Ron Garret <[EMAIL PROTECTED]> writes:
>In article <[EMAIL PROTECTED]>,
> Steve Holden <[EMAIL PROTECTED]> wrote:
>> I wouldn't necessarily say you are wrong here, It's just that the cgi
>> module has sort of "just growed", so it isn't conveniently factyored for
>> reusability in other contexts
In article <[EMAIL PROTECTED]>,
Steve Holden <[EMAIL PROTECTED]> wrote:
> I wouldn't necessarily say you are wrong here, It's just that the cgi
> module has sort of "just growed", so it isn't conveniently factyored for
> reusability in other contexts. Several people (including me) have taken
>
>>Let me get this right. You are aware that CGIHTTPServer module exists.
>>>But you don't want to use that. Instead you want to use your own code.
>>>So you have ended up duplicating some of the functionality of the cgi
>>>library. And it feels like a hack.
&
you'll need to read the source of cgi.parse_qs (like Steve did) and
> see what it needs from os.environ and then provide that (either in
> os.environ or in a custom environ dictionary).
I ended up just copying and hacking the code. It was only a dozen lines
or so. But it stil
e that. Instead you want to use your own code.
> > So you have ended up duplicating some of the functionality of the cgi
> > library. And it feels like a hack.
> >
> > Have I missed anything? :-)
>
> Hey, be nice. Wanting to write a request handler that actually handles a
>
In article <[EMAIL PROTECTED]>,
Steve Holden <[EMAIL PROTECTED]> wrote:
> Ron Garret wrote:
> > In article <[EMAIL PROTECTED]>,
> > Steve Holden <[EMAIL PROTECTED]> wrote:
> >
> >
> >>But basically, you aren't providing a CGI environment, and that's why
> >>cgi.parse() isn't working.
> >
> >
Ron Garret wrote:
> In article <[EMAIL PROTECTED]>,
> Steve Holden <[EMAIL PROTECTED]> wrote:
>
>
>>But basically, you aren't providing a CGI environment, and that's why
>>cgi.parse() isn't working.
>
>
> Clearly. So what should I be doing? Surely I'm not the first person to
> have this pr
>> But basically, you aren't providing a CGI environment, and that's why
>> cgi.parse() isn't working.
>
> Clearly. So what should I be doing?
Probably you'll need to read the source of cgi.parse_qs (like Steve did) and
see what it needs from os.environ and then provide that (either in
os.envir
In article <[EMAIL PROTECTED]>,
Steve Holden <[EMAIL PROTECTED]> wrote:
> But basically, you aren't providing a CGI environment, and that's why
> cgi.parse() isn't working.
Clearly. So what should I be doing? Surely I'm not the first person to
have this problem?
I have managed to work aroun
as its standard input.
>
>
> Doesn't work. (I even tried sys.stdin=r.rfile; s=cgi.parse()) Don't
> forget, this is not a CGI script, it's a handler for a BaseHTTPServer.
>
>
Right. My bad. However there's clearly something screwy going on,
because other
ried sys.stdin=r.rfile; s=cgi.parse()) Don't
forget, this is not a CGI script, it's a handler for a BaseHTTPServer.
> > 2. Despite the fact that I'm passing a 1 for the keep_blank_values
> > argument to cgi.parse_qs, it doesn't actually keep blank values. Is
>
Ron Garret wrote:
> I'm trying to figure out how to use BaseHTTPServer. Here's my little
> test app:
>
> =
>
> #!/usr/bin/python
>
> from BaseHTTPServer import *
>
> import cgi
>
> class myHandler(BaseHTTP
I'm trying to figure out how to use BaseHTTPServer. Here's my little
test app:
=
#!/usr/bin/python
from BaseHTTPServer import *
import cgi
class myHandler(BaseHTTPRequestHandler):
def do_GET(r):
s = ''
try:
s = cgi.parse
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 somethin
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 BaseHTTPSe
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()
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?
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, all I wanted to know where the post data was stored from the
request
--
http://mail.python.org/mailman/listinfo/python-list
"amfr" <[EMAIL PROTECTED]> 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
>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
--
http://mail.python.org/mailman/listinfo/python-list
>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
--
http://mail.python.org/mailman/listinfo/python-list
27;t know for sure;
> assuming BaseHTTPServer is good enough for my current needs aside from
> its lack of threading, does PooledThreadedServer have any advantages
> over the method I linked above?
The biggest difference (and you can decide whether it's an advantage for
your environment
Never mind... I've found a workable solution:
http://mail.python.org/pipermail/python-list/2001-August/062214.html
Robert, thanks, I'll still check that out for any future projects; but
for my current purpose, it seems overkill. But I don't know for sure;
assuming BaseHTTPServer
Adam Atlas wrote:
> 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 lower-level
> socket things (and probably thus have to write my own HTT
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 lower-level
socket things (and probably thus have to write my own HTTP code)?
Thanks.
Adam
--
http
> to use a port below 1000 on a Unix system one needs root priviledges.
> But it's dangerous to execute all of a script under those priviledges.
> Therefore I'd like to drop the root priviledges as soon as possible.
> (How) is this possible?
>
Are you sure you don't just want to use twisted?
http
Hi,
to use a port below 1000 on a Unix system one needs root priviledges.
But it's dangerous to execute all of a script under those priviledges.
Therefore I'd like to drop the root priviledges as soon as possible.
(How) is this possible?
Many thanks for a hint,
Helmut Jarausch
Lehrstuhl fuer Nu
It's not that, here is definition that I use:
class myWebServer(SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer):
pass
code that runs server:
server = myWebServer(('', 80), myWebHTTPHandler)
LOG("Web Server starting")
server.serve_forever()
and here is shortened version of myWebHTTPHandl
"Tortelini" <[EMAIL PROTECTED]> writes:
> I am making custom web server using HTTPServer and want to be able to
> access it simultaneously from different computers. To achieve
> multithreading, I have been experimenting with ThreadingMixIn from
> SocketServer, but it doesn't seem to work,
One com
I am making custom web server using HTTPServer and want to be able to
access it simultaneously from different computers. To achieve
multithreading, I have been experimenting with ThreadingMixIn from
SocketServer, but it doesn't seem to work, when I freeze code in one
instance it seems to be frozen
It should be very safe to count on the host header. Maybe some really
really old browser would not support that. But they probably won't work in
today's WWW anyway. Majority of today's web site is likely to be virtually
hosted. One Apache maybe hosting for 50 web addresses. If a client strip
Thanks, aurora ;),
aurora wrote:
If you actually want the IP, resolve the host header would give you that.
I' m only interested in the hostname.
The second form of HTTP request without the host part is for
compatability of pre-HTTP/1.1 standard. All modern web browser should
send the Host heade
If you actually want the IP, resolve the host header would give you that.
In the redirect case you should get a host header like
Host: www.python.org
From that you can reconstruct the original URL as
http://www.python.org/ftp/python/contrib/. With that you can open it using
urllib and proxy the
Hi list,
My ultimate goal is to have a small HTTP proxy which is able to show a
message specific to clients name/ip/status then handle the original
request normally either by redirecting the client, or acting as a proxy.
I started with a modified[1] version of TinyHTTPProxy postet by Suzuki
His
70 matches
Mail list logo