CherryPy upload file
<p>I'm want to POST a file from a python3 client to cherrypy. I'm using the requests library.
My client code:</p>

<pre><code>import requests

url = 'http://127.0.0.1:8080/upload'
files = {'file.zip': open('file.zip', 'rb')}

r = requests.post(url, files=files)
</code></pre>

<p>My server code:</p>

<pre><code>import os
import tempfile
import shutil

import cherrypy


config = {
    'global' : {
        'server.socket_host' : '127.0.0.1',
        'server.socket_port' : 8080,
        'server.thread_pool' : 8,
        'server.max_request_body_size' : 0,
        'server.socket_timeout' : 60
  }
}


class App:
    @cherrypy.config(**{'response.timeout': 3600})
    @cherrypy.expose()
    def upload(self):
        '''Handle non-multipart upload'''

        destination = os.path.join('/home/uvv/upload')
        with open(destination, 'wb') as f:
            shutil.copyfileobj(cherrypy.request.body, f)

        return 'Okay'


if __name__ == '__main__':
        cherrypy.quickstart(App(), '/', config)
</code></pre>

<p>The server returns an error: </p>

<pre><code>127.0.0.1 - - [17/Aug/2016:11:38:49] "POST /upload HTTP/1.1" 400 2083 "" "python-requests/2.10.0"
</code></pre>