2024-05-15 00:53:01 发布
网友
我有这个命令,需要用python执行我的程序
curl -H 'Content-Type: application/x-ndjson' -XPOST '192.168.1.149:9200/shakespeare/doc/_bulk?pretty' --data-binary @file.json
使用requests - HTTP for humans,它允许您发送任何您喜欢的HTTP查询
import requests r = requests.post('192.168.1.149:9200/shakespeare/doc/_bulk?pretty', json=datadict) print(r.text)
试试这样的方法:
import requests import json headers = { 'Content-Type': 'application/x-ndjson', } params = (('pretty', ''),) data = open('file.json', 'rb').read() response = requests.post('http://192.168.1.149:9200/shakespeare/doc/_bulk', headers=headers, params=params, data=data) print(response.text)
注意:根据curl命令,这只是一个示例。你知道吗
谢谢!希望对你有帮助!:)
使用requests - HTTP for humans,它允许您发送任何您喜欢的HTTP查询
试试这样的方法:
注意:根据curl命令,这只是一个示例。你知道吗
谢谢!希望对你有帮助!:)
相关问题 更多 >
编程相关推荐