Posts

Showing posts with the label web

Sending Binary files over xml rpc

I'm posting this because I finally figured how to send files(pictures in particular) over xmlrpc. It took me a while to figure it out since I was mostly concerned with saving the files into database but here it is. #!/usr/bin/env python from  twisted.web import  xmlrpc, server import  os class   PositRPC (xmlrpc.XMLRPC):          def   xmlrpc_savefile (self, file):                 datum = file.data                 thefile = open(' /tmp/gnu.jpg ', " wb ")                  #filebuffer = file                 thefile.write(datum)             ...