Use of both "files" and "json" in POST causes no data to be sent

From a Python3 client to a Rails server

This doesn't throw an error: 

`response = requests.post(url, files=files, json=data)`

And when I send it, the files reach their destination, but **not the data**.

```
({"file"=>#<ActionDispatch::Http::UploadedFile:0x007fe825f6a260 @tempfile=#<Tempfile:/var/folders/hk/k9bttnlx3w114g2730b1bzrm0000gp/T/RackMultipart20161018-34415-1kizyxd.jpg>, @original_filename="b688139f3be64de09606dd603a437d27.jpg", @content_type=nil, @headers="Content-Disposition: form-data; name=\"file\"; filename=\"b688139f3be64de09606dd603a437d27.jpg\"\r\n">, "form"=>:json, "controller"=>"api/v1/agents/events", "action"=>"create", "agent_id"=>"5"})
```

Now if I remove files from the named parameters, it works as intended, but **without the files**:

`response = requests.post(url, json=data)`

```
({"device_id"=>"5", "wifi_networks"=>[{"mode"=>"Master", "frequency"=>"2.452 GHz", "ssid"=>"ATT29426J6", "signal"=>-22, "channel"=>9, "address"=>"E0:B7:0A:61:0F:D0", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "48 Mb/s"], "quality_now"=>"70", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.447 GHz", "ssid"=>"WiPS", "signal"=>-90, "channel"=>8, "address"=>"00:12:5F:10:16:C0", "encryption_type"=>nil, "bitrates"=>["1 Mb/s", "48 Mb/s"], "quality_now"=>"20", "quality_max"=>"70", "encrypted"=>false}, {"mode"=>"Master", "frequency"=>"2.452 GHz", "ssid"=>"WiPS", "signal"=>-87, "channel"=>9, "address"=>"00:12:5F:11:6E:E6", "encryption_type"=>nil, "bitrates"=>["1 Mb/s", "48 Mb/s"], "quality_now"=>"23", "quality_max"=>"70", "encrypted"=>false}, {"mode"=>"Master", "frequency"=>"2.462 GHz", "ssid"=>"", "signal"=>-86, "channel"=>11, "address"=>"26:4E:5A:94:FD:E2", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"24", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"", "signal"=>-83, "channel"=>6, "address"=>"36:1F:E4:E1:90:EC", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"27", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"xfinitywifi", "signal"=>-88, "channel"=>6, "address"=>"DC:FE:07:93:52:2A", "encryption_type"=>nil, "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"22", "quality_max"=>"70", "encrypted"=>false}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"Tunneltop", "signal"=>-86, "channel"=>6, "address"=>"38:6B:BB:CA:70:B0", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "48 Mb/s"], "quality_now"=>"24", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"xfinitywifi", "signal"=>-86, "channel"=>6, "address"=>"4E:7A:8A:3C:60:4E", "encryption_type"=>nil, "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"24", "quality_max"=>"70", "encrypted"=>false}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"Law Office 1", "signal"=>-83, "channel"=>6, "address"=>"2C:30:33:EB:93:6B", "encryption_type"=>"wpa2", "bitrates"=>["1 Mb/s", "48 Mb/s"], "quality_now"=>"27", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"PINC", "signal"=>-92, "channel"=>6, "address"=>"50:A7:33:06:7A:F8", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"18", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.437 GHz", "ssid"=>"", "signal"=>-86, "channel"=>6, "address"=>"5E:7A:8A:3C:60:4E", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"24", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.462 GHz", "ssid"=>"", "signal"=>-88, "channel"=>11, "address"=>"BE:34:26:1B:23:DC", "encryption_type"=>"wpa", "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"22", "quality_max"=>"70", "encrypted"=>true}, {"mode"=>"Master", "frequency"=>"2.462 GHz", "ssid"=>"xfinitywifi", "signal"=>-90, "channel"=>11, "address"=>"16:4E:5A:94:FD:E2", "encryption_type"=>nil, "bitrates"=>["1 Mb/s", "54 Mb/s"], "quality_now"=>"20", "quality_max"=>"70", "encrypted"=>false}], "pressure"=>101614.79052823315, "event_type"=>"Photo", "altitude"=>-24.35893568577765, "agent_public_key"=>"coyvfx0wlsri6thjuapg2nz3mb57841d9keq", "user_agent_id"=>"1", "gps"=>{"error"=>{}, "altitude"=>0.0, "longitude"=>0.0, "latitude"=>0.0}, "temperature"=>21.1, "accelerometer"=>[4088, 2, 1028], "agent_private_key"=>"", "form"=>:json, "controller"=>"api/v1/agents/events", "action"=>"create", "agent_id"=>"5", "event"=>{}})
```

Any ideas?


`files` and `json` do not work together, unfortunately. While I'd be open to receiving a patch to have those work together, you'll find that you almost certainly need the low-level control of the [requests-toolbelt `StreamingMultipartDataEncoder`](https://toolbelt.readthedocs.io/en/latest/uploading-data.html#streaming-multipart-data-encoder).