Как конфертировать из curl в python
Как преобразовать это в запросы Python?
curl --noproxy '*' -H "Content-Type: application/json; charset=utf-8" \
-k --user "admin:password" \
-d"search=| savedsearch mysearch" \
-X POST 'https://splunk:8089/services/search/jobs'
def no_ssl_verification(session=requests.Session):
old_request = session.request
session.request = partialmethod(old_request, verify=False)
with warnings.catch_warnings():
warnings.simplefilter('ignore', InsecureRequestWarning)
yield
session.request = old_request
url='https://splunk:8089/services/search/jobs'
jsonDict = {"search": "search=| savedsearch mysearch"}
print(jsonDict)
proxy = {'http': None, 'https': None}
with no_ssl_verification():
r = requests.post(url, data=jsonDict, headers={'username':'admin',
'password':'password'}, json=jsonDict, verify=False, proxies=proxy)
print (r.text)
=========
<?xml version="1.0" encoding="UTF-8"?>
<response>
<messages>
<msg type="ERROR">Unauthorized</msg>
</messages>
</response>