python - Writing to a uWSGI unix socket -
I have a Python wsgi app that is served by UWSGI behind NGinx. NGinx listens on the network and requests the UWSGI Unix Socket located in /tmp/uwsgi.socket .
Now, I'm trying to emulate what I'm guessing NGinx while talking to this socket I have tried to use the following Python: < Pre>
import socket uwsgi_socket_address = "/tmp/uwsgi.sock" socket_client = socket.socket (socket.AF_UNIX, socket.SOCK_STREAM) socket_client.connect (uwsgi_socket_address)) Msg = "GET / index HTTP / 1.1 \ r \ N "socket_client.sendall (msg)
I get this error in return
/ usr / lib / python2.7 / socket.pyc meth (Name, self, * args) 222 223 DEF Math (name, self, * R GSA): - & gt; 224 Returns Getattr (self._sock, name) (* Args) for 225 226 in _socketmethods _m: error: [Errno 32] broken pipe 1) I also try to possible Is that socket and with UWGGI? If so, then what is missing to do this work?
2) Is there a Python utility that can help me in preparing HTTP requests of text instead of asking myself on the server? Like:
gt; & Gt; Import some httplib & gt; & Gt; & Gt; Http = somehttplib () & gt; & Gt; & Gt; Request = http.get ('/ index') & gt; & Gt; & Gt; Request.text == 'GET / Index HTTP / 1.1 \ r \ n True [/ code>
You can not say HTTP on one server while speaking 'uwsgi' protocol. The UVSPP protocol is a simple binary sorting format for arrays and dictionaries. If you want to tell the HTTP from the UWSG server, then you have to configure it to speak in HTTP with --http-socket rather than --socket.
You can have the same example with both of them:
uwsgi --http-socket & lt; Address1 & gt; --set & lt; Address2 & gt; ...
Eventually you can easily apply a UVSB serializer with some lines.
This is an example of a parser (you need to vice versa):
Here you find the glasses:
Comments
Post a Comment