Check uwsgi's uwsgi protocol communication with uwsgi-tools

Note.

If you execute uwsgi as shown below, you can communicate using the uwsgi protocol.

Putting behind a full webserver

$uwsgi --socket 127.0.0.1:3031 --wsgi-file foobar.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191

However, in the above cases, I felt that the connection test from the client would be troublesome.

I found the following Github issue when I googled

how to test uwsgi unix socket ? #1443

As mentioned above, uwsgi-tools seems to be convenient, so I tried using it.

andreif/uwsgi-tools

Installation

Installation is possible with pip

uwsgi-tools 1.1.1

$pip install uwsgi-tools

How to use

The basic usage is described in the README.

andreif/uwsgi-tools

If you are listening to the uwsgi protocol on localhost, you can check it as follows.

$uwsgi_curl localhost:3031
HTTP/1.1 200 OK
Content-Type: text/html

You can also test the connection on a remote host as follows.

$uwsgi_curl hogefuga:3031
HTTP/1.1 200 OK
Content-Type: text/html

reference

ʻImport socket`, and it seems that socket communication is being performed.

https://github.com/andreif/uwsgi-tools/blob/master/uwsgi_tools/curl.py#L9

The uwsgi Protocol

The protocol works mainly via TCP but the master process can bind to a UDP Unicast/Multicast for The embedded SNMP server or cluster management/messaging requests.

The following is likely to be a study

Let's study socket communication with python

Recommended Posts

Check uwsgi's uwsgi protocol communication with uwsgi-tools
Just check serial communication with tk
Serial communication with Python
Socket communication with Python
Non-blocking with Python + uWSGI
HTTP communication with Python
Domain check with Python
WebSocket with Python + uWSGI
Check version with python