/usr/share/doc/mongrel2-core/examples/python/mongrel2/control.py is in mongrel2-core 1.11.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from mongrel2.handler import CTX
from mongrel2 import tnetstrings
import zmq
class ControlPort(object):
def __init__(self, addr):
self.sock = zmq.Socket(CTX, zmq.REQ)
self.sock.connect(addr)
def request(self, name, **args):
msg = tnetstrings.dump([name, args])
self.sock.send(msg)
rep = self.sock.recv()
result, remain = tnetstrings.parse(rep)
return result
|