diff options
author | jaseg <s@jaseg.de> | 2013-09-16 16:37:15 +0200 |
---|---|---|
committer | jaseg <s@jaseg.de> | 2013-09-16 16:37:15 +0200 |
commit | 26bf093af79166b502724c2ca4f8fa5924205ec2 (patch) | |
tree | e2c983ad00ce390cc00ca14ade87c8e5050b6f1e /ponysay-qotd | |
parent | ea24fc5026cc85ba363c9a6496789a018498ece4 (diff) | |
download | ponysay-26bf093af79166b502724c2ca4f8fa5924205ec2.tar.gz ponysay-26bf093af79166b502724c2ca4f8fa5924205ec2.tar.bz2 ponysay-26bf093af79166b502724c2ca4f8fa5924205ec2.zip |
Fixed setup stuff. Python setuptools really is a pain.
Diffstat (limited to 'ponysay-qotd')
-rwxr-xr-x | ponysay-qotd | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/ponysay-qotd b/ponysay-qotd deleted file mode 100755 index 134a895..0000000 --- a/ponysay-qotd +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 -import random -from socketserver import ThreadingMixIn, TCPServer, BaseRequestHandler -import ponysay - -# Quote-Of-The-Day protocol implementation using ponysay backend -# See RFC865 ( https://tools.ietf.org/html/rfc865 ) for details. -# To prevent traffic amplification attacks we are only providing a TCP service. - -class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass - -ponylist = ponysay.list_ponies_with_quotes() - -class QOTDHandler(BaseRequestHandler): - def handle(self): - pony = random.choice(ponylist) - s = ponysay.render_pony(pony, ponysay.random_quote(pony), - balloonstyle=ponysay.balloonstyles['cowsay'], - center=True, - centertext=False, - width=120) - self.request.sendall(bytes(s, "UTF-8")) - -if __name__ == "__main__": - HOST, PORT = "", 8017 - server = ThreadingTCPServer((HOST, PORT), QOTDHandler) - server.serve_forever() |