view encryptobin.py @ 0:1c8dbbdce596

Origination.
author Atul Varma <varmaa@toolness.com>
date Tue, 07 Apr 2009 16:07:54 -0700
parents
children
line wrap: on
line source

import atulweb
import config

blob = ''

@atulweb.wsgiapp
def application(environ, start_response):
    global blob
    if environ['PATH_INFO'] == '/' + config.SECRET:
        if environ['REQUEST_METHOD'] == 'GET':
            return atulweb.Response(blob)
        elif environ['REQUEST_METHOD'] == 'PUT':
            blob = environ['atulweb.request'].get_input()
            return atulweb.Response('OK')
        else:
            raise atulweb.HttpError('method not allowed')
    else:
        raise atulweb.HttpError('not found')

if __name__ == '__main__':
    atulweb.main(application)