Glip Bot with Python

  • 1
  • Question
  • Updated 5 months ago
  • Answered
Hello,

I trying to setup a bot using Python, but it doesn't seems like the Python SDK has the same methods as the JS SDK.

For example, with the JS SDK, it seems possible to do something like:

rcsdk = new RC({ server: RINGCENTRAL_ENV, appKey: CLIENT_ID, appSecret: CLIENT_SECRET});
platform.login({ code : req.query.code, redirectUri : REDIRECT_HOST + '/oauth' });

Taken from https://github.com/pkvenu/developing-locally-with-Glip/blob/master/app.js

But, in the Python SDK, the login method of the Platform class only takes username and password.

Reference: https://github.com/ringcentral/ringcentral-python/blob/master/ringcentral/platform/platform.py

It doesn't seem like there's a way to do something equivalent with the 'Python SDK' after adding the app/Bot to Glip to finally get the permanent token?
Photo of Mg

Mg

  • 180 Points 100 badge 2x thumb

Posted 5 months ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,288 Points 5k badge 2x thumb
I checked the code of the official Python SDK, it doesn't support authorization code flow. I created an GitHub issue: https://github.com/ringcentral/ringcentral-python/issues/14

You can use this unofficial SDK instead: https://github.com/tylerlong/ringcentral-python It does support authorization code flow: https://github.com/tylerlong/ringcentral-python#step-4-authorize
(Edited)
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,288 Points 5k badge 2x thumb
And there is a way to get a permanent token without writing any code: https://github.com/tylerlong/ringcentral-token-generator

As long as you get the token, you can set the token to the Python SDK. Thus you can skip the authorization step (because you've already got the token).
Photo of John Wang

John Wang, Official Rep

  • 5,278 Points 5k badge 2x thumb
An authorization code demo app using the official ringcentral-python SDK is available here:

https://github.com/ringcentral/ringcentral-demos-oauth/tree/master/python-bottle
Photo of Mg

Mg

  • 180 Points 100 badge 2x thumb
Thanks! I was able to get the token using the current SDK.