Questions tagged [wsgiref]
40 questions
3
votes
2 answers
In google app engine, how to iterate through form fields (python, wsgiref.handlers)
Using python and wsgiref.handlers, I can get a single variable from a form with self.handler.request.get(var_name), but how do I iterate through all form variables, be they from GET and POST? Is it something like this?
for field in…

MarcoB
- 301
- 1
- 2
- 11
2
votes
1 answer
python wsgiref auto reload
I try to use wsgiref as a server like below:
from wsgiref.simple_server import make_server
if __name__ == '__main__':
app = Application(control)
run = make_server('', 5000, app)
print('Demo server started http://localhost:5000')
…

Amirhosein Shirani
- 395
- 1
- 3
- 13
2
votes
2 answers
How to get rid of extra cgi-bin url components running a Flask App using wsgiref CGIHandler?
I am on a shared cpanel hosting plan that does not support wsgi apps directly. So I have to use the wsgiref CGIHandler workaround, as described here: http://flask.pocoo.org/docs/0.12/deploying/cgi/ .
It all works and produces expected results, but…

Tux-Lamer
- 31
- 3
2
votes
0 answers
Why does wsgiref have such redundant statements?
When I read the source code of wsgiref (version 0.1), the class SimpleHandler which contained two functions _write and _flush confused me. I think self._write = self.stdout.write and self._flush = self.stdout.flush are redundant. When I commented it…

mutex86
- 59
- 6
2
votes
0 answers
webapp2/wsgiref: "multiple values for keyword argument" when running on WSGI server
The following code raises an error if I run it on a WSGI server, but not otherwise.
class Handler(webapp2.RequestHandler):
def __init__(self, template, *args, **kwargs):
print "Kwargs in Handler:", kwargs
self.template =…

Anubhav C
- 2,631
- 2
- 18
- 23
1
vote
2 answers
AppEngine confusion - CGI, WSGI-compliant?
I'm confused.
If AppEngine is supposed to allow running of WSGI-employing apps ..
# somewhere in a webapp.RequestHandler
env = dict(os.environ.items())
for key, value in env.items():
self.response.out.write(key+': '+value+'
') req_uri =…
') req_uri =…

maligree
- 5,939
- 10
- 34
- 51
1
vote
2 answers
Python 3.0 `wsgiref` server not functioning
I can't seem to get the wsgiref module to work at all under Python 3.0. It works fine under 2.5 for me, however. Even when I try the example in the docs, it fails. It fails so hard that even if I have a print function above where I do: "from…

Evan Fosmark
- 98,895
- 36
- 105
- 117
1
vote
1 answer
How is Bottle's built-in WSGI server different from the standard Python wsgiref server module?
What is Bottle doing in its wsgiref server implementation that the built in Python WSGIref simple server is not? When I look at Bottle, for example, it adheres to the WSGI standard and the documentation states:
1.5.1 Server Options The built-in…

johnny
- 19,272
- 52
- 157
- 259
1
vote
1 answer
make_server() check if bind to port succeeded
In Python 2 and 3k, using wsgi.simple_server.make_server(host, port, app) does not raise an exception when the port is already in used. Instead, a call to .server_forever() or .handle_request() simply blocks until the other port closes and the next…

Niklas R
- 16,299
- 28
- 108
- 203
1
vote
1 answer
How to override the server version string with wsgiref.simple_server?
Using Python 2.7.2 on OSX (darwin), I would like to hide or customize the "Server" response header sent by the wsgiref.simple_server.make_server().
I tried many things without any success and was pretty sure this sample code should work:
from…

fbparis
- 880
- 1
- 10
- 23
0
votes
0 answers
How do I implement a mutli thread / timeout function using wsgiref - Python 3.10.6
I've been using wsgiref to create an HTTP server but notice that there is no timeout limit / multithreading, so one client can infinitely hold up the server. Here is an example application for demonstration:
from wsgiref.simple_server import…

Chris
- 154
- 8
0
votes
1 answer
Unable to build python3-wsgiref in yocto 3.1.10
I'm trying to build a Yocto image including a python service (radicale), that requires wsgiref from Python3. Wsgiref is part of Python3, however, in poky, there is no default recipe providing python3-wsgiref. In order to build it, the following…

Imanoid
- 11
- 2
0
votes
1 answer
How to pass arguments to wsgiref application in Python?
A wsgiref application function has to look as follows:
def application(environ, start_response):
start_response is just a function, while environ does not have any parameters set by the user…

wojciech-graj
- 25
- 1
- 5
0
votes
1 answer
Broken image when serving it over HTTP
I came across a problem reading image files (.png, .jpg, .jpeg ...) where I get the following error in the terminal: UnicodeDecodeError: the 'utf-8' codec cannot decode the 0x89 byte in position 0 : invalid starting byte. I thought I had solved the…

João Carlos
- 23
- 3
0
votes
1 answer
Why does wsgiref.simple_server report content-type of request as 'text/plain' while none was sent?
Output from client.py is text/plain although no content-type header was sent to the server.
Why?
# ---------------------------------------------- server.py
from wsgiref.simple_server import make_server
def simple_app(environ, start_response):
…

Piotr Dobrogost
- 41,292
- 40
- 236
- 366