diff options
author | jaseg <s@jaseg.de> | 2013-07-29 19:29:32 +0200 |
---|---|---|
committer | jaseg <s@jaseg.de> | 2013-07-29 19:56:31 +0200 |
commit | 13f954f4ecace0c4888e194c75a26666fa3fc305 (patch) | |
tree | 73935ab0012f0e722efee915ecb77af58b930350 /ponysay-qotd.py | |
parent | 1466970c712fbd3f8579fdc995acc80e0e115299 (diff) | |
download | ponysay-13f954f4ecace0c4888e194c75a26666fa3fc305.tar.gz ponysay-13f954f4ecace0c4888e194c75a26666fa3fc305.tar.bz2 ponysay-13f954f4ecace0c4888e194c75a26666fa3fc305.zip |
Added a proper setup.py
Diffstat (limited to 'ponysay-qotd.py')
-rwxr-xr-x | ponysay-qotd.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/ponysay-qotd.py b/ponysay-qotd.py deleted file mode 100755 index 2530d8f..0000000 --- a/ponysay-qotd.py +++ /dev/null @@ -1,26 +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) - self.request.sendall(bytes(s, "UTF-8")) - -if __name__ == "__main__": - HOST, PORT = "", 8017 - server = ThreadingTCPServer((HOST, PORT), QOTDHandler) - server.serve_forever() |