question

rick-smith2386 avatar image
rick-smith2386 asked rick-smith2386 answered

Python ringcentral.http.api_exception.ApiException: Unknown error

Using this code:
It ringcentral.http.api_exception.ApiException: Unknown error
I was thinking this may be related to the Python version I was using 3.7 so I switched to 3.6 no joy (What version(s) of Python does it work with BTW?) I'm at a standstill here, any ideas?

from ringcentral import SDK
#sdk = SDK(CLIENT_ID, CLIENT_SECRET, SERVER)
platform = sdk.platform()
platform.login(user, extension, password) #this throws unknown error
builder = sdk.create_multipart_builder()
builder.set_body({
    'from': {'phoneNumber': '15551212'},
    'to': [{'phoneNumber': '15551213'}],
    'text': 'message'
})

request = builder.request('/account/~/extension/~/sms')
response = platform.send_request(request)



General Topic
1 |1500 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
Could you please inspect the HTTP response and post the full body here? Normally there should be a error code and a helpful message from server side.
1 |1500 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.

rick-smith2386 avatar image
rick-smith2386 answered
Tyler,
Thanks for the response: Here's what  I have:
-        _ApiException__apiResponse    <ringcentral.http.api_response.ApiResponse object at 0x00000001026DE748>    ApiResponse

        api_response    <function ApiException.api_response at 0x0000000103493158>    function

-        headers    {'Accept': 'application/json', 'Authorization': 'Basic NVZSUUMtSnRUa...hV2ZxUQ==', 'Content-Type': 'application/x-www-f...rlencoded', 'RC-User-Agent': 'Unnamed/0.0.0 win32...K/VERSION', 'User-Agent': 'Unnamed/0.0.0 win32...K/VERSION'}    dict

        ['User-Agent']    'Unnamed/0.0.0 win32/VERSION PYTHON/VERSION RCPYTHONSDK/VERSION'    str

Thanks Again!






1 |1500 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
Could you please post the body of ApiResponse ?  Try something like str(ApiResponse ) or ApiResponse.json()

Or 

try:
    ...
except Exception as e:
    print(str(e))
1 |1500 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.

rick-smith2386 avatar image
rick-smith2386 answered
Tyler thanks for your response!
I get this
Exception: Refresh token has expired


1 |1500 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
That's weird. You can create an issue here:  https://github.com/ringcentral/ringcentral-python/issues

In the mean time, you can try my SDK:  https://github.com/tylerlong/ringcentral-python
1 |1500 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.

rick-smith2386 avatar image
rick-smith2386 answered
Tyler.
Thanks much I will try both.


1 |1500 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.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys