Python Forum

Full Version: Curl command to python requests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I am very new to python and would appreciate some help with the following. I have this curl command which works fine:
curl --cacert C:\cacert.pem -u user:key -F "[email protected]" https://serverurl/users/pictures
I converted the curl command to:
picture = {
	'data' : ('picture',open('picture.jpg','rb'))
}
req = requests.post('https://serverurl/users/pictures',files=picture, auth=('user','key'))
I get 200 response but the picture does not get uploaded to the server. Not sure what I am missing. Thank you!