title: Python requests - POST data from a file
body: <p>I have used curl to send POST requests with data from files.</p>
  
  <p>I am trying to achieve the same using python requests module. Here is my python script</p>
  
  <pre><code>import requests
  payload=open('data','rb').read()
  r = requests.post('https://IP_ADDRESS/rest/rest/2', auth=('userid', 'password'), data=payload , verify=False)
  print r.text
  </code></pre>
  
  <p>Data file looks like below</p>
  
  <pre><code>'ID' : 'ISM03'
  </code></pre>
  
  <p>But my script is not POSTing the data from file. Am I missing something here. </p>
  
  <p>In Curl , I used to have a command like below</p>
  
  <pre><code>Curl --data @filename -ik -X POST 'https://IP_ADDRESS/rest/rest/2' 
  </code></pre>