Questions tagged [basehttpserver]

This Python class is used to make a simple HTTP web server.

Related links

126 questions
0
votes
1 answer

How can I safely update the handler of a BaseHTTPServer under Linux?

I'm trying to write a program that changes the content of a webpage with some user given parameters. After several tries and some googling, i've managed to get some results (I put the webserver in a thread in order to continue other tasks in the…
F. Zion
  • 3
  • 2
0
votes
0 answers

File upload error Nothing matches the given URI

i'm trying to upload a file using python 2.7 requests and BaseHTTPServer, here's the server POST config try: ctype, pdict = cgi.parse_header(s.headers.getheader('content-type')) if ctype == 'multipart/form-data' : fs…
0
votes
1 answer

Interfacing BaseHttpServer to WSGI in python

I am taking a python course where they use BaseHTTPServer. The code they start with is here from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class webServerHandler(BaseHTTPRequestHandler): def do_GET(self): try: …
0
votes
1 answer

BaseHTTPServer, extracting variable from POST single value

I want to know how to get variables form content POSTed with a html form, located on an external server. I have this code : myserver.py import BaseHTTPServer HOST_NAME = '' PORT_NUMBER=8000 postVars = '' class…
laur
  • 500
  • 1
  • 9
  • 23
0
votes
2 answers

Python - BaseHTTPServer , issue with POST and GET

I am making a very simple application with 2 webpages at the moment under URLs: localhost:8080/restaurants/ and localhost:8080/restaurants/new. I have a sqlite database which i manipulate with SQLAlchemy in my python code. On my first page …
Hamza
  • 2,180
  • 3
  • 14
  • 18
0
votes
1 answer

Build a server with BaseHTTPServer for public network?

Trying to build a simple server: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class MyHandler(BaseHTTPRequestHandler): def do_GET(self): try: self.send_response(200) …
Shane
  • 4,875
  • 12
  • 49
  • 87
0
votes
0 answers

I need to get HTTP request header for TRACE?

I'm using python 2.7 and I want to implement the do_TRACE function for my HTTP server and I'm using the BaseHTTPServer library. I want to get the request header. How can I get it? How can I get the length of it? Please help me... def…
0
votes
1 answer

BaseHTTPServer socket close after python script exit

I already searched for solutions to my questions and found some, but they don't work for me or are very complicated for what I want to achieve. I have a python (2.7) script that creates 3 BaseHTTPServers using threads. I now want to be able to…
Michael
  • 13
  • 3
0
votes
0 answers

Singlethreaded Python BaseHTTPServer

I am using a simple BaseHTTPServer in Python 2.6.6 or 2.7.5 The docs state that it is singlethreaded and I can find no clue in the docs or the sourcecode for BaseHTTPServer or SocketServer that this is not the case. But the following code starts an…
deif
  • 1
  • 1
0
votes
1 answer

Python BaseHTTPServer vs Apache and mod_wsgi

I am setting up a very simple HTTP server for the first time, am considering my options, and would appreciate any feedback on the best way to proceed. My goal is pretty simple: I'm not serving any files, I only need to respond to a very specific…
hyssop
  • 183
  • 1
  • 2
  • 12
0
votes
1 answer

How to pre-process requests before handling them using BaseHTTPServer?

I want to deny access to certain paths on my server, which is using the CGIHttpServer module. I've come up with a whitelist that I'll need to check on every request, but my problem is how to implement it. I tried overriding the handle_one_request…
rvighne
  • 20,755
  • 11
  • 51
  • 73
0
votes
1 answer

Python BaseHTTPServer serving files faster

I have some relatively large .js files (flot and jquery) to serve with a Python BaseHTTPServer. Currently I am using: with open(curdir + sep + self.path, 'rb') as fd: self.wfile.write(fd.read()) But its rather slow, even loading the files from…
jayjay
  • 1,017
  • 1
  • 11
  • 23
0
votes
1 answer

Start daemon process within BaseHTTPServer

In order to allow helpdesk to restart an Oracle Instance, we are trying to implement a small python webserver that would start a shell script that starts the Oracle instance. The code is done and it starts the instance but there is a problem: the…
0
votes
1 answer

CGI FieldStorage will only return None?

I put together the following script that i would like to return the "Hello World !('192.168.0.162', 48344)bob" when in my browser i have server:8081/?first_name=bob however when i run the following program it returns Hello World !('192.168.0.162',…
0
votes
1 answer

Python: BaseHTTPServer global var?

I'm new to python and wondering if it is possible using BaseHTTPServer to store a global var that is accessible to all requests? Basically I have an async process that requires a POST back into the server as a separate request from the original…
kwolfe
  • 1,663
  • 3
  • 17
  • 27
1 2 3
8
9