2016-05-17 3 views
1

私はSplunk REST APIに対してリクエストしようとしています。Splunk REST API:curlで201、Pythonで404?

curl -k https://host:8090/services/collector/event -H "Authorization: Splunk AUTH_CODE" -d '{"event":"Hello, World!","source":"Airwatch","index":"client-myclient"}' 
{"text":"Success","code":0}% 

しかし、私はPythonで同じ要求を引くしようとすると、私は404エラーを取得:カールとのAPIを呼び出すときにgreateの作品

splunkhost = 'MY_IP' 
splunkUrl = 'https://%s:8090/services/collector/event' % splunkhost 
splunkData = {'index':'client-myclient','event':'Event Python Test'} 
splunkResponse = requests.get(splunkUrl, headers={'Authorization': 'Splunk AUTH_CODE'}, data = splunkData, verify=False) 
print splunkResponse.text 

/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning) 
{"text":"The requested URL was not found on this server.","code":404} 

を私は不安定な警告が私から来て理解しますverify = false。ヘッダーが通過しているように見えます(splunkResponse.erquest.headersで正しく表示されます)。私の別のテストでは何も指定されていません...

何が欠けていますか?

答えて

1

curlは、PythonがGETのときのPOST要求でした。解決済み。

関連する問題