title: How to specify python requests http put body?
body: <p>I'm trying to rewrite some old python code with requests module.
  The purpose is to upload an attachment.
  The mail server requires the following specification :</p>
  
  <pre><code>https://api.elasticemail.com/attachments/upload?username=yourusername&amp;api_key=yourapikey&amp;file=yourfilename
  </code></pre>
  
  <p>Old code which works:</p>
  
  <pre><code>h = httplib2.Http()        
          resp, content = h.request('https://api.elasticemail.com/attachments/upload?username=omer&amp;api_key=b01ad0ce&amp;file=tmp.txt', 
          "PUT", body=file(filepath).read(), 
          headers={'content-type':'text/plain'} )
  </code></pre>
  
  <p>Didn't find how to use the body part in requests.</p>
  
  <p>I managed to do the following:</p>
  
  <pre><code> response = requests.put('https://api.elasticemail.com/attachments/upload',
                      data={"file":filepath},                         
                       auth=('omer', 'b01ad0ce')                  
                       )
  </code></pre>
  
  <p>But have no idea how to specify the body part with the content of the file.</p>
  
  <p>Thanks for your help.
  Omer.</p>