Comments (10)
Monkeypatch workaround
import yarl
original_with_query = yarl.URL.with_query
def new_with_query(self, *args, **kwargs):
if kwargs:
query = kwargs
elif len(args) == 1:
query = args[0]
if isinstance(query, Mapping) and 'refresh' in query and isinstance(query['refresh'], bool):
query['refresh'] = '1' if query['refresh'] else '0'
return original_with_query(self, *args, **kwargs)
yarl.URL.with_query = new_with_query
from aioes.
Would you provide a patch which fixes aioes, without yarl monkeypatching?
from aioes.
There're two ways of solving this problem: modifying yarl for bool support and replacing bool parameters everywhere is aioes. What can you consider correct?
from aioes.
The second one
from aioes.
Any plans on merging this and doing a new release soon?
from aioes.
@wintamute I would prefer to be able to convert from bool instead passing as is. refresh=True
looks more reasonable than refresh=1
.
from aioes.
@neumond I agree, I was referring to the commit above (DLizogub@77c4d56)
Edit: I just checked that commit again, my bad, the fix should be to convert here to str instead of passing as is so that yarl doesn't complain later on. I didn't try it I admit.
Using a local modified version doesn't really help me since I need a version the build system can just download.
from aioes.
A less hackish monkey-patch to workaround this issue as well as #112
from aioes.connection import Connection
__original_perform_request = Connection.perform_request
def perform_request(self, method, url, params, body):
url = url.lstrip('/') # Fixes issue #112
if params:
for key, value in params.items():
if isinstance(value, bool):
params[key] = str(value).lower()
return __original_perform_request(self, method, url, params, body)
Connection.perform_request = perform_request
from aioes.
Hey, guys! Please check this out with latest master!
from aioes.
Looks very much so. Many thanks for giving some love to ES5 support.
from aioes.
Related Issues (20)
- Raise ElasticsearchException derived class if "cannot connect", not aiohttp exception.
- HTTP Basic Auth HOT 7
- aioes 0.2 release HOT 5
- Synchronous bridging HOT 1
- Make Connection use ClientSession instead of aiohttp.request
- Aiohttp changed session.close to coroutine HOT 1
- What versions of Elasticsearch does this support? HOT 8
- aiohttp 1.2+ ClientSession issues HOT 1
- aioes 0.5.0 not compatible with aiohttp 1.1.0 HOT 1
- aioes broken with ES 5.x HOT 5
- yarl (0.8.1) not compatible and not able to add http headers HOT 1
- When program terminate, asyncio:Unclosed client session HOT 2
- CA_CERT support
- delete_by_query return 404 with Elastic Search 5 HOT 1
- Add scan helper HOT 2
- implement pluggable serializer HOT 1
- create without await not working
- aioes does not encode datetime.datetime.now()
- Error occurs in ElasticSearch.connection.perform_request
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aioes.