So first of all, when working with verbs using curl, you have to use -X VERBNAME
, e.g.,
~# curl -X POST http://httpbin.org/post
{
"url": "http://httpbin.org/post",
"data": "",
"json": null,
"args": {},
"form": {},
"origin": "127.0.0.1",
"headers": {
"User-Agent": "curl/7.19.6 (x86_64-unknown-linux-gnu) libcurl/7.19.6 OpenSSL/0.9.8n zlib/1.2.3 libidn/1.5",
"Connection": "close",
"Accept": "*/*",
"Content-Length": "0",
"Host": "httpbin.org"
},
"files": {}
}
Second of all, with the parameter being mentioned I would try these variations:
import requests
# Variation 1
r = requests.post(url, data={'username': 'exampleuser'})
# Variation 2
r = requests.post(url, params={'username': 'exampleuser'})
# Followed by these lines
print r.status_code
print r.text
The equivalents in cURL should look something like this:
# Variation 1 equivalent
curl --data='username=exampleuser' -X POST http://httpbin.org/post
# Variation 2 equivalent
curl -X POST http://httpbin.org/post?username=exampleuser
I'm guessing by the second line that this is supposed to be an application/x-www-form-urlencoded
POST
request so the first variations of both should work. I'm not at all familiar with tableau though, so I can't guarantee either will work.