Skip to content

A python 3.5+ async library for the WinRM protocol

License

Notifications You must be signed in to change notification settings

cournape/aio-winrm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python 3.5+ library implementing the WinRM protocol on top of asyncio. Work in
progress: no TLS (plain text only), API not stable.

aio-winrm is licensed under the APACHE 2.0 license.

Sync API:

    from aiowinrm.sync import run_cmd

    host = "192.168.1.1"
    auth = ("user", "password")
    response = run_cmd(host, auth, "ipconfig", ("/all",))

Tentative async API:

    import asyncio
    from aiowinrm import run_cmd

    def callback_factory(host):
        """ Returns a callback that prefix every output line by host.
        """
        def callback(s):
            output = "\n".join(
                host + ":" + line
                for line in s.splitlines()
            )
            print(output)

        return callback

    host = "172.17.5.2"
    auth = ("vagrant", "vagrant")
    loop = asyncio.get_event_loop()
    loop.run_until_complete(
        run_cmd(
            host, auth, "ipconfig", ("/All",),
            stdout_callback=callback_factory(host),
            stderr_callback=callback_factory(host),
        )
    )
    loop.close()

About

A python 3.5+ async library for the WinRM protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages