title: Does Python-Requests support OrderedDicts, or is something else going wrong here?
body: <p>I'm trying to POST a request to an Amazon S3 endpoint using Python's <a href="http://docs.python-requests.org/en/latest/" rel="nofollow">Requests</a> library. The request is of the multipart/form-data variety, because it includes the POSTing of an actual file.</p>
  
  <p>One requirement specified by the API I'm working against is that the <code>file</code> parameter must be posted <em>last</em>. Since Requests uses dictionaries to POST multipart/form-data, and since dictionaries don't follow a dictated order, I've converted it into an OrderedDict called <code>payload</code>. It looks something like this before POSTing it:</p>
  
  <pre><code>{'content-type': 'text/plain',
   'success_action_redirect':     'https://ian.test.instructure.com/api/v1/files/30652543/create_success?uuid=&lt;opaque_string&gt;',
   'Signature': '&lt;opaque_string&gt;',
   'Filename': '',
   'acl': 'private',
   'Policy': '&lt;opaque_string&gt;',
   'key': 'account_95298/attachments/30652543/log.txt',
   'AWSAccessKeyId': '&lt;opaque_string&gt;',
   'file': '@log.txt'}
  </code></pre>
  
  <p>And this is how I POST it:</p>
  
  <pre><code>r = requests.post("https://instructure-uploads.s3.amazonaws.com/", files = payload)
  </code></pre>
  
  <p>The response is a 500 error, so I'm really not sure what the issue is here. I'm just guessing that it has to do with my use of OrderedDict in Requests—I couldn't find any documentation suggesting Requests does or doesn't support OrderedDicts. It could be something completely different. </p>
  
  <p>Does anything else stick out to you that would cause the request to fail? I could provide more detail if need be.  </p>
  
  <p><em><strong>Okay, update, based on Martijn Pieters' earlier comments:</em></strong></p>
  
  <p>I changed the way I'm referencing the log.txt file by adding it to the already created <code>upload_data</code> dictionary like this:</p>
  
  <pre><code>upload_data['file'] = open("log.txt")
  </code></pre>
  
  <p>pprinting the resulting dictionary I get this:</p>
  
  <pre><code>{'AWSAccessKeyId': '&lt;opaque_string&gt;',
   'key': '&lt;opaque_string&gt;',
   'Policy': '&lt;opaque_string&gt;',
   'content-type': 'text/plain',
   'success_action_redirect': 'https://ian.test.instructure.com/api/v1/files/30652688/create_success?uuid=&lt;opaque_string&gt;',
   'Signature': '&lt;opaque_string&gt;',
   'acl': 'private',
   'Filename': '',
   'file': &lt;_io.TextIOWrapper name='log.txt' mode='r' encoding='UTF-8'&gt;}
  </code></pre>
  
  <p>Does that value for the <code>file</code> key look correct? </p>
  
  <p>When I post it to a RequestBin I get this, which looks pretty similar to Martin's example:</p>
  
  <pre><code>POST /1j92n011 HTTP/1.1
  User-Agent: python-requests/1.1.0 CPython/3.3.0 Darwin/12.2.0
  Host: requestb.in
  Content-Type: multipart/form-data; boundary=e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Length: 2182
  Connection: close
  Accept-Encoding: identity, gzip, deflate, compress
  Accept: */*
  
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="AWSAccessKeyId"; filename="AWSAccessKeyId"
  Content-Type: application/octet-stream
  
  &lt;opaque_string&gt;
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="key"; filename="key"
  Content-Type: application/octet-stream
  
  &lt;opaque_string&gt;
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="Policy"; filename="Policy"
  Content-Type: application/octet-stream
  
  &lt;opaque_string&gt;
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="content-type"; filename="content-type"
  Content-Type: application/octet-stream
  
  text/plain
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="success_action_redirect"; filename="success_action_redirect"
  Content-Type: application/octet-stream
  
  https://ian.test.instructure.com/api/v1/files/30652688/create_success?uuid=&lt;opaque_string&gt;
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="Signature"; filename="Signature"
  Content-Type: application/octet-stream
  
  &lt;opaque_string&gt;
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="acl"; filename="acl"
  Content-Type: application/octet-stream
  
  private
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="Filename"; filename="Filename"
  Content-Type: application/octet-stream
  
  
  --e8c3c3c5bb9440d1ba0a5fe11956e28d
  Content-Disposition: form-data; name="file"; filename="log.txt"
  Content-Type: text/plain
  
  This is my awesome test file.
  --e8c3c3c5bb9440d1ba0a5fe11956e28d--
  </code></pre>
  
  <p>However, I still get a 500 returned when I try to POST it to <a href="https://instructure-uploads.s3.amazonaws.com/" rel="nofollow">https://instructure-uploads.s3.amazonaws.com/</a>. I've tried just adding the open file object to <code>files</code> and then submitting all the other values in a separate dict through <code>data</code>, but that didn't work either.</p>