gpt4 book ai didi

python - 如何在* aioes *中更改Content-Type

转载 作者:行者123 更新时间:2023-12-03 00:50:13 24 4
gpt4 key购买 nike

我正在使用库,并且在尝试执行此脚本时:

from aioes import Elasticsearch

import asyncio


@asyncio.coroutine
def check():
host = 'localhost'
port = 1234

es = Elasticsearch(['{host}:{port}'.format(host=host, port=port)])

answer = yield from es.search(index="test-index", body={})
print(answer)


loop = asyncio.get_event_loop()
loop.run_until_complete(check())

我收到此错误: aioes.exception.TransportError: TransportError(406, '{"error":"Content-Type header [application/octet-stream] is not supported","status":406}')
我曾尝试过Internet,但没有找到任何解决方案。我哪里错了?

最佳答案

aioes已被放弃,我不认为它支持ES6.0及更高版本,这要求指定内容 header 。如果您查看aioes github,他们现在建议使用“官方” ES python客户端。

https://github.com/aio-libs-abandoned/aioes

关于python - 如何在* aioes *中更改Content-Type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54889517/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com