Code Monkey home page Code Monkey logo

bearychat.py's Introduction

Python SDK for BearyChat

@BearyChat Build Status Development Status Documentation Status

Documentation

Requirements

Installation

Use pip to install bearychat SDK.

$ pip install bearychat

or for development:

$ git clone https://github.com/bearyinnovative/bearychat.py.git
$ cd bearychat.py
$ python setup.py install

Examples

Incoming

from bearychat import incoming

def main():
    data = {
        "text": "hello, **world**",
        "markdown": True,
        "notification": "Hello, BearyChat in Notification",
        "channel": "testing"
    }

    resp = incoming.send(
        "https://hook.bearychat.com/=bw52O/incoming/token",
        data)

    print(resp.status_code)
    print(resp.text)


if __name__ == "__main__":
    main()

Real Time Message

BearyChat SDK DOES NOT provide rtm loop, you should implement it with your favorite websocket library.

A reference implmenetation can be found at examples/rtm_loop.py

OpenApi

from bearychat import openapi

client = openapi.Client('<your token>')
message_query_param = {
    "vchannel_id": "=bw52O",
    "query": {
        "latest": {
            "limit": 1
        }
    }
}
client.message.query(json = message_query_param)

"""
{u'messages': [{u'updated': u'2018-10-19T07:23:51.000+0000', u'attachments': [], u'is_channel': True, u'created': u'2018-10-19T07:23:51.000+0000', u'text': u'hello \u9080\u8bf7 \u80e1\u4f2f\u673a\u5668\u4eba \u52a0\u5165\u8be5\u8ba8\u8bba\u7ec4', u'created_ts': 1539933830697, u'subtype': u'info', u'team_id': u'=bwDBo', u'key': u'1539933830697.0487', u'refer_key': None, u'robot_id': None, u'fallback': None, u'vchannel_id': u'=bwPzN', u'uid': u'=bwZbY'}]}
"""

OpenApi Online Document: http://openapi.bearychat.help

Development

OpenAPI Client Building

$ ./scripts/gen_api.py > bearychat/openapi/_api.py

Using Other Libraries

User Demos

License

MIT

bearychat.py's People

Contributors

a972667237 avatar bcho avatar kenan2002 avatar shonenada avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.