Created
August 13, 2012 14:21
-
-
Save VincentVetsch/3341192 to your computer and use it in GitHub Desktop.
Python: Authenticate
This file contains hidden or 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
if data.startswith("hello secret", 0) : | |
if data == "hello secret lemmetalk\n": | |
s.send("client authenticated\n") | |
# store the fact that this client has been authenticated in another list | |
# which keeps track of authenticated clients | |
# define this list at the top near where you defined the list for select sockets | |
else: | |
s.send("client not authenticated\n") | |
s.close() | |
input.remove(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment