Last active
December 13, 2015 19:49
-
-
Save six519/4965681 to your computer and use it in GitHub Desktop.
Quote of the day shit!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
.. module:: qotd_shit | |
.. moduleauthor:: Ferdinand (The **Brain Damage**) Silva <ferdinandsilva@ferdinandsilva.com> | |
Just got bored again and played around with some few lines of code in Python | |
================================ | |
List of operational QOTD Servers | |
================================ | |
#. alpha.mike-r.com | |
#. ota.iambic.com | |
`My GitHub <https://github.com/six519>`_ | |
""" | |
import socket | |
QOTD_SERVER = "ota.iambic.com" | |
con = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
qotd = "" | |
try: | |
con.connect((QOTD_SERVER,17)) | |
while True: | |
buff = con.recv(1024) | |
if len(buff) > 0: | |
qotd += buff | |
else: | |
break | |
con.close() | |
print qotd | |
except (socket.gaierror,socket.error) as e: | |
print e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment