diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/encryptobin.py	Tue Apr 07 16:07:54 2009 -0700
@@ -0,0 +1,21 @@
+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)