title: using python to send json and files to flask
body: <p>I have this issue where I am trying to send/receive to a flask API some file and JSON in a single function. </p>
  
  <p>On my client ( sender ) I have : </p>
  
  <pre><code>#my json to be sent 
  datas = {'var1' : 'var1','var2'  : 'var2',}
  #my file to be sent 
  local_file_to_send = 'user_picture.jpg'
  url = "http://10.100.2.6:80/customerupdate"
  headers = {'Content-type': 'multipart/form-data'}
  files = {'document': open(local_file_to_send, 'rb')}
  r = requests.post(url, files=files, data=datas, headers=headers)
  </code></pre>
  
  <p>On my Flask server I have : </p>
  
  <pre><code>class OPERATIONS(Resource):
          @app.route('/',methods=['GET'])
          def hello_world():
              return 'Hello World!'
  
          @app.route('/customerupdate',methods=['GET','POST'])
          def customerupdate():
              event_data_2 = json.loads(request.get_data().decode('utf-8'))
              print event_data_2
  </code></pre>
  
  <p>I have this error message telling me that the data is actually not a json format nor a utf8 format. If I print the content of the "get_data" without trying to decode it shows some binary characters.. </p>
  
  <p>What would be the syntax on my client to read the json and write the file locally ?</p>