monero-python icon indicating copy to clipboard operation
monero-python copied to clipboard

[enhancment] asyncio support could be useful

Open moneroexamples opened this issue 6 years ago • 6 comments

asyncio support could be a nice enhancement of the project. For now the project uses requests to interact with monero wallet and daemon through rpc in a blocking fashion.

Thus a possible improvement could be to support aiohttp and asyncio for asynchronous programming.

moneroexamples avatar Apr 26 '19 03:04 moneroexamples

Great idea! Non-blocking API would be great for many applications. However, I have no experience with that in Python. If you think you could start it, please go ahead.

emesik avatar Apr 26 '19 08:04 emesik

Unfortunately, I will not have time to work on that in near future, as all my time goes to moneroexamples projects at present. But it could be good exercise and learning experience for anyone interested in modern python developments.

moneroexamples avatar Apr 26 '19 09:04 moneroexamples

I have done some projects using the aiohttp library. I can look into this more, but also make no promises as life usually gets in the way of my nerd hobbies :)

lalanza808 avatar Apr 27 '19 19:04 lalanza808

Doesn't look like aiohttp supports digest authentication out of the box, only basic auth. There's a 2 year PR sitting on the project for it though: https://github.com/aio-libs/aiohttp/pull/2213

I believe the JSON RPC interfaces only accept digest auth, plus it would be preferred over plain text basic auth anyways. I'll look around for some other viable libraries that make use of non-blocking HTTP calls that support digest auth. The project only makes use of HTTP calls in one single file so implementing won't be too difficult, will probably spend more time refactoring tests :)

lalanza808 avatar Apr 27 '19 20:04 lalanza808

I don't know that I can make it asynchronous and still work with Python 2 unless we want to fork the logic and write it twice. Should we rip off the band-aid?

lalanza808 avatar Aug 13 '19 06:08 lalanza808

Py2 is going away next year, so I guess we shouldn't worry about backward incompatible changes. I can manage backporting other features for some time, as the project isn't very busy.

Let's do it on a separate branch, though.

emesik avatar Aug 13 '19 08:08 emesik