title: Python request gives 415 error while post data unless data = {'key':'value'}
body: <p>I am doing a straight forward request as follows.</p>
  <pre><code>import requests
  
  def user_transactions():
      url = 'https://webapi.coinfloor.co.uk/v2/bist/XBT/GBP/user_transactions/'
      
      data = {'key':'value'}
      r = requests.post(url, data=data, auth=(&quot;some_username&quot;, &quot;some_password&quot;) )
      print(r.status_code)
      print(r.text)
      return
  </code></pre>
  <p>Even though <code>data=</code> is optional in the documents.
  <a href="https://www.w3schools.com/python/ref_requests_post.asp" rel="nofollow noreferrer">https://www.w3schools.com/python/ref_requests_post.asp</a></p>
  <ol>
  <li>If i <strong>comment out</strong> the <code>data</code> variable then the routine returns a
  <code>status_code=415</code> error.</li>
  <li>If i <strong>include</strong> in the <code>data</code> variable then the routine returns a <code>status_code=200</code> success.</li>
  </ol>
  <p>I have tried to look this up, for example here:
  <a href="https://stackoverflow.com/questions/52216808/python-request-gives-415-error-while-post-data">Python request gives 415 error while post data</a> , but with no answer.</p>
  <p>The question is:  Why is it the case that [1] fails but [2] works ?</p>