aioetcd
aioetcd copied to clipboard
Support python3 < 3.4.2
This pull request slightly modifies the implementation so that Python3 versions older than 3.4.2 can use this library. The loop.create_task is only available in 3.4.2 and as indicated here https://docs.python.org/3/library/asyncio-eventloop.html#coroutines the way to support older versions is by using asyncio.async.
I was running a stand alone etcd instance and when running the simple_client.py the leader function would return 404 page not found. This seems to be the case when running etcd stand alone as I get the same thing when going directly to etcd.
$ curl -L http://127.0.0.1:4001/v2/leader
404 page not found
I've added a change so that the leader function will return the leader or None.
I have also added a simple __str__ to the Node class so that the simple_client.py script can display some meaningful information when it does print(result). So now instead of seeing:
client_get
<aioetcd.FileNode object at 0x7f8a12879550>
it will show:
client_get
key=/hello, value=43, expiration=None, ttl=None, raft_index=6740
Seems good. I'd like to test it on travis with a python < 3.4.2 before i merge. Thank you
Any chance you were going to pull this request? I ask because I have had someone send me a pull request for additional changes because my fork is now leading yours. I also have a few fixes of my own to push too.