mytja / PloudOS-API

An unofficial API for PloudOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PloudOS-API

An unofficial API for PloudOS.

This library contains a lot of functions and is fully asynchronous.

Example

import asyncio
from ploudos import PloudOS

myserverid = 0
ploudos = PloudOS("myusername", "mypassword", myserverid)

async def main():
    await ploudos.login()
    info = await ploudos.get_server_info()
    if info.get("isRunning") is True and info.get("isStarted") is True:
        # It's already started and running
        return
    print(info)
    cr = await ploudos.can_restart()
    print(cr)
    if cr:
        await ploudos.restart()
    else:
        q = await ploudos.queue()
        if q:
            print("Server accepting is necessary. Executing the command.")
            await ploudos.accept_server()
    print(await ploudos.get_server_info())
    await asyncio.sleep(10)
    print(await ploudos.stop())

asyncio.run(main())

About

An unofficial API for PloudOS

License:MIT License


Languages

Language:Python 100.0%