8000 more detailed error message, better quickstart code · michaelhelmick/twilio-python@277120e · GitHub
[go: up one dir, main page]

Skip to content

Commit 277120e

Browse files
committed
more detailed error message, better quickstart code
1 parent 613af1d commit 277120e

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

docs/getting-started.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Making a Call
1111
1212
from twilio.rest import TwilioRestClient
1313
14-
client = TwilioRestClient()
14+
# To find these visit https://www.twilio.com/user/account
15+
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
16+
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"
17+
18+
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
1519
call = client.calls.make(to="9991231234", from_="9991231234",
1620
url="http://foo.com/call.xml")
1721
print call.length

twilio/rest/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,21 @@ def __init__(self, account=None, token=None, base="https://api.twilio.com",
9393
if not account or not token:
9494
account, token = find_credentials()
9595
if not account or not token:
96-
raise TwilioException("Could not find account credentials")
96+
raise TwilioException("""
97+
Twilio could not find your account credentials. Pass them into the
98+
TwilioRestClient constructor like this:
99+
100+
client = TwilioRestClient(account='AC38135355602040856210245275870',
101+
token='2flnf5tdp7so0lmfdu3d')
102+
103+
Or, add your credentials to your shell environment. From the terminal, run
104+
105+
echo "export TWILIO_ACCOUNT_SID=AC3813535560204085626521" >> ~/.bashrc
106+
echo "export TWILIO_AUTH_TOKEN=2flnf5tdp7so0lmfdu3d7wod" >> ~/.bashrc
107+
108+
and be sure to replace the values for the Account SID and auth token with the
109+
values from your Twilio Account at https://www.twilio.com/user/account.
110+
""")
97111

98112
auth = (account, token)
99113
version_uri = "%s/%s" % (base, version)

0 commit comments

Comments
 (0)
0