I am using RingCentral API to get call log information.
I am interested in an attribute called from
which tells us who was the caller who made the call. To access the caller name, I need to access a call record -> then go to the last leg (root of the call) and then get the from attribute, and then get the name of the caller.
E.g:
"from": { "name": "andy murray", "phoneNumber": "+44712345656" }
resp = platform.get('/restapi/v1.0/account/~/call-log', params)
for record in resp.json().records:
print(record.legs[-1].from.name)
After running this command, I am getting error:
File "demo.py", line 43
print(record.legs[-1].from.name )
SyntaxError: invalid syntax
It looks like Python is not able to comprehend that this "from" is not part of Python itself. How can I define Python to consider this as an attribute of a JSON object?
Any help will be appreciated!