The last component of this quickstart is retrieving your call logs using the Twilio REST API. You can find your logs by going to the the Logs page of your account on the Twilio web site, but getting access to this data programmatically is useful for automated reporting, or building other fully-featured systems like a voicemail application.
To get a list of recent calls, perform an HTTP GET request to the Calls resource URI.
Here is all the code you need to retrieve your list of calls.
This tutorial assumes you have a Python development environment with
twilio-python helper library. Please see our post on [setting up your
environment][devenvironment] if you need help installing those programs.
from twilio.rest import Client # To find these visit https://www.twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXX" auth_token = "YYYYYYYYYYYYYYYYYY" client = Client(account_sid, auth_token) for call in client.api.account.calls.list(): print("From: " + call.from_formatted + " To: " + call.to_formatted)
Then open the Terminal and run the above script to retrieve your list of calls:
$ python get_logs.py