$ git clone https://github.com/ringcentral/python-sdk.git ./ringcentral-python-sdk
Install dependencies:
$ pip install ringcentral
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)
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