xapi-project / xen-api

The Xapi Project's XenAPI Server
http://xenproject.org/developers/teams/xapi.html
Other
346 stars 283 forks source link

Python AsyncIO support #3805

Open pashazz opened 5 years ago

pashazz commented 5 years ago

Are there any plans for this? So that I could hypothetically do:

    res = await session.login_with_password('login', 'password')
    all_vms = await session.xenapi.VM.get_all_records()
    print(all_vms)
    vm_ref = await session.xenapi.VM.get_by_uuid('uuid')
    halt_async = await session.xenapi.Async.VM.shutdown(vm_ref)
    print(halt_async)
    await session.close()
mseri commented 5 years ago

I don’t know about plans, although I am sure that python 2.7 compatibility will be still needed for a while, but you can actually already do it either straight with https://pypi.org/project/aioxmlrpc or with minimal changes to xapirpc.py using that package instead of xmlrpc (and dropping few decorators around). And xapirpc.py is a module that changes extremely rarely

pashazz commented 5 years ago

well don't you mean XenAPI.py? I've ported it to https://github.com/mosquito/aiohttp-xmlrpc and I can probably share it after some tests

mseri commented 5 years ago

Oh yes, I emant exactly that, sorry :)