Skip to content

Instantly share code, notes, and snippets.

@VincentVetsch
Created August 13, 2012 14:21
Show Gist options
  • Save VincentVetsch/3341192 to your computer and use it in GitHub Desktop.
Save VincentVetsch/3341192 to your computer and use it in GitHub Desktop.
Python: Authenticate
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