diff README.txt @ 30:a99009a7013c 0.3.1a

- Use generator with __getfile__ (uses much less memory) - Fixed security issue with __getfile__ - do not allow access to whole disk! - Handle exceptions in auth function - Fixed encrypting of no password - Changed README code examples
author Ben Croston <ben@croston.org>
date Thu, 05 Apr 2012 20:45:56 +0100
parents bea0c77734ca
children fdddfd434bbd
line wrap: on
line diff
--- a/README.txt	Tue Feb 28 13:49:33 2012 +0000
+++ b/README.txt	Thu Apr 05 20:45:56 2012 +0100
@@ -20,8 +20,9 @@
             """Your code placed here"""
             return 'Something', myvar
 
-    application = AuthRPCApp(api(), auth=myauth)
-    simple_server.make_server('localhost', 1234, application)
+    application = AuthRPCApp(api(), auth=myauth, filepath='/home/myapp/datadir')
+    server = simple_server.make_server('localhost', 1234, application)
+    server.serve_forever()
 
 Example Usage (Client):
 
@@ -34,7 +35,13 @@
                          password='secret',
                          user_agent='myprogram')
     retval = client.do_something('test')
-    file_contents = client.__getfile__('myfile.pdf')
+
+    # get a file and save local copy
+    file_contents_generator = client.__getfile__('myfile.pdf')
+    with open('myfile_downloaded.pdf', 'wb') as f:
+        for data in file_contents_generator:
+            f.write(data)
+
     batch = BatchCall(client)
     batch.do_something('call 1')
     batch.do_something('call 2')