title: Python requests post a file
body: <p>Using CURL I can post a file like</p>
  
  <pre><code>CURL -X POST -d "pxeconfig=`cat boot.txt`" https://ip:8443/tftp/syslinux
  </code></pre>
  
  <p>My file looks like</p>
  
  <pre><code>$ cat boot.txt
  line 1
  line 2
  line 3
  </code></pre>
  
  <p>I am trying to achieve the same thing using <em>requests</em> module in python</p>
  
  <pre><code>r=requests.post(url, files={'pxeconfig': open('boot.txt','rb')})
  </code></pre>
  
  <p>When I open the file on server side, the file contains</p>
  
  <pre><code>{:filename=&gt;"boot.txt", :type=&gt;nil, :name=&gt;"pxeconfig", 
  :tempfile=&gt;#&lt;Tempfile:/tmp/RackMultipart20170405-19742-1cylrpm.txt&gt;, 
  :head=&gt;"Content-Disposition: form-data; name=\"pxeconfig\"; 
  filename=\"boot.txt\"\r\n"}
  </code></pre>
  
  <p>Please suggest how I can achieve this.</p>