I am doing a straight forward request as follows.
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=("some_username", "some_password") )
print(r.status_code)
print(r.text)
return
Even though data=
is optional in the documents.
https://www.w3schools.com/python/ref_requests_post.asp
- If i comment out the
data
variable then the routine returns astatus_code=415
error. - If i include in the
data
variable then the routine returns astatus_code=200
success.
I have tried to look this up, for example here: Python request gives 415 error while post data , but with no answer.
The question is: Why is it the case that [1] fails but [2] works ?