Skip to content

Instantly share code, notes, and snippets.

@caleywoods
Created July 10, 2011 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caleywoods/1074847 to your computer and use it in GitHub Desktop.
Save caleywoods/1074847 to your computer and use it in GitHub Desktop.
random password generator using paste
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