![](/img/trans.png)
[英]How to specify the “Content-Type” and “Accept” on FormRequest?
[英]How to change the Content-Type in *aioes*
我正在使用库aioes,并且在尝试执行此脚本时:
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及更高版本,这要求指定内容标头。 如果您查看aioes github,他们现在建议使用“官方” ES python客户端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.