Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.29 KB

README.rst

File metadata and controls

63 lines (44 loc) · 1.29 KB

aiociscospark

info:Asyncio based sdk for Cisco Spark

Installation

pip install aiociscospark

Usage

import asyncio

from aiociscospark import people

TOKEN = 'xxxxx'

async def main():
    spark = people.People(TOKEN)
    me = await spark.me()
    print(me)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Creating a bot

import os
import asyncio
from aiociscospark.bot import CommandBot, botcommand


class UselessBot(CommandBot):
    @botcommand
    async def useless(self, _):
        """
        Pretty much useless
        Usage: useless
        """
        return "I am useless"


if __name__ == '__main__':
      access_token = os.environ["TOKEN"]
      url = os.environ["BASE_URL"]
      loop = asyncio.get_event_loop()
      bot = UselessBot(access_token, url, loop)
      bot.run_server(8080)