![]() # Navigation bar towards the top of the page, then select the App you wish # your developer account and then clicking on Console in the Blue You can get this information by logging into # This replaces the two code bocks above and goes directly to the # put them into script variables for use in the API calls # the code below will get the values you just loaded in the step above and # os.environ('RECIPIENT_PHONE') = 'EnterYourValidationInfoHere' # os.environ('RC_EXTENSION') = 'EnterYourValidationInfoHere' # os.environ('RC_PASSWORD') = 'EnterYourValidationInfoHere' # os.environ('RC_USERNAME') = 'EnterYourValidationInfoHere' # os.environ('RC_SERVER_URL') = 'EnterYourValidationInfoHere' # os.environ('RC_CLIENT_SECRET') = 'EnterYourValidationInfoHere' # os.environ('RC_CLIENT_ID') = 'EnterYourValidationInfoHere' # !!!! NOTE, the code below is not included in the QuickStart Python Script # function to set the variables that the script usese here # we could choose to set the envrionment variables and then use a get # RECIPIENT_PHONE: The phone number to send the SMS to ![]() # RC_USERNAME, RC_PASSWORD, RC_EXTENSION: Auth credentials # RC_CLIENT_ID, RC_CLIENT_SECRET, RC_SERVER_URL: Connection info # quick-start.py - This script helps developers send their first SMS message Even though it is an easy fix, I am sure there are other people like me who have never used Python before that would like a "plug and play" solution, and if I am really lucky someone who knows Python can chime in on the use cases for the os.envrion.get and how to set that up to persist across all of the various RingCentral scripts that a company may choose to deploy. So, like I said, I wanted to the modification to the Python quickstart script that did work for me, I literally just replaced the right side of the = with my API validation information and once that was complete, it was working as expected. My question is: What is the benefit of using environment variables if there isn't a way to set them for other scripts in a way that would let us call all of our various RingCentral scripts while easily changing the API validation information from a single source? When we could just do this and not have to worry about environment variables: Os.environ = 'm圜lientID'ĬLIENTID = os.environ.get('RC_CLIENT_ID') I am hoping someone can advise me on the benefits of using the os.envrion.get() methods and how they should be used and set, because this seems somewhat redundant: Check credentials" error to be thrown.ĭigging into this problem, it appears that the get method is intended to pull environment variables, so I figured that this was used to set the user data in a single place and make it easy to maintain changes, but when I searched around I learned that this is not possible with Python and would require some Bash shell trickery if it were going to work as expected. I tried changing the data in the get('USER_DATA_VARIABLES') to the data that is available in my developer account API, but this caused the "Unable to authenticate to platform. # RECIPIENT = os.environ.get('RECIPIENT_PHONE') # EXTENSION = os.environ.get('RC_EXTENSION') # PASSWORD = os.environ.get('RC_PASSWORD') # USERNAME = os.environ.get('RC_USERNAME') # SERVER = os.environ.get('RC_SERVER_URL') ![]() # CLIENTSECRET = os.environ.get('RC_CLIENT_SECRET') # CLIENTID = os.environ.get('RC_CLIENT_ID') The instructions in the quickstart say to save the example script as sms.py and then add in your account access information into the following variables: I have been able to successfully set up the Python script in a Linux machine, though it required modification to get working, so I thought I would ask a question about why the original code did not work and share the simple changes I had to make to get it working. Net version of SMS Quickstart set up, I decided to try my luck with Python3 instead. I have been asked to set up SMS testing as part of a RingCentral rollout at work, and after trying and failing to get the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |