question

mg8729 avatar image
mg8729 asked ·

Glip Bot with Python

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?


aaa
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered ·
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
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered ·
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).
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

John Wang avatar image
John Wang answered ·
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
1 comment Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks! I was able to get the token using the current SDK. 
1 Like 1 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.