Skip to content

tylingsoft/ringcentral-python

 
 

Repository files navigation

RingCentral SDK for Python

Build Status

Installation

Manual

$ git clone https://github.com/ringcentral/python-sdk.git ./ringcentral-python-sdk

Install dependencies:

PIP

$ pip install ringcentral

Usage

For more info take a look on the test.py in this repository.

from ringcentral import SDK

sdk = SDK('APP_KEY', 'APP_SECRET', 'SERVER')
platform = sdk.platform()
platform.login('USERNAME', 'EXTENSION', 'PASSWORD')

res = platform.get('/account/~/extension/~')
print('User loaded ' + res.json().name)

Subscribing for server events

from threading import Thread
from time import sleep
from ringcentral.subscription import Events

def on_message(msg):
    print(msg)

def pubnub():
    s = sdk.create_subscription()
    s.add_events(['/account/~/extension/~/message-store'])
    s.on(Events.notification, on_message)
    s.register()
    while True:
        sleep(0.1)

try:
    try:
        import Pubnub
        t = Thread(target=pubnub)
        t.start()
    except ImportError as e:
        print("No Pubnub SDK, skipping Pubnub test")
        
except KeyboardInterrupt:
    pass

About

RingCentral Connect Platform Python SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.5%
  • Makefile 1.5%