title: ValueError: cannot encode objects that are that are not 2-tuples
body: <p>I'm trying to upload a file to server and I get this error:</p>
  
  <pre><code>ValueError: cannot encode objects that are that are not 2-tuples
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>import requests
  from StringIO import StringIO
  buffer = StringIO()
  
  url = 'http://example.com/files/'
  user, password = 'ex', 'ample'
  
  buffer.write(open(r'C:\Users\example\Desktop\code\de.txt','rb').read()) 
  
  r = requests.post(url,  auth=(user, password), files=buffer.getvalue())
  </code></pre>
  
  <p>I tried <code>auth=HTTPBasicAuth(user, pass)</code> but that didn't work either. What can be the solution?</p>