Created
July 10, 2011 18:55
-
-
Save caleywoods/1074847 to your computer and use it in GitHub Desktop.
random password generator using paste
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
import string | |
from random import choice | |
from webob import Request, Response | |
def GenPass(length): | |
return ''.join([choice(string.letters + string.digits) for i in range(int(length))]) | |
def GenPassWeb(environ, start_response): | |
r = Request(environ) | |
l = r.GET['length'] | |
response = Response(content_type='text/plain', body=GenPass(l)) | |
return response(environ, start_response) | |
def main(): | |
from paste.httpserver import serve | |
serve (GenPassWeb) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment