8000 Merge pull request #25 from dennispi/master · michaelhelmick/twilio-python@91d4f64 · GitHub
[go: up one dir, main page]

Skip to content

Commit 91d4f64

Browse files
committed
Merge pull request twilio#25 from dennispi/master
Updated README - fixed numerous errors
2 parents e17fbdb + 016171e commit 91d4f64

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,54 @@ Getting started with the Twilio API couldn't be easier. Create a Twilio REST cli
1212

1313
### API Credentials
1414

15-
`TwilioRestClient` needs your Twilio credentials. While these can be passed in directly to the constructor, we suggest storing your credentials as environment variables. Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.
15+
To get started, the `TwilioRestClient` needs your Twilio credentials. You can either pass these directly to the constructor (see the code below) or via environment variables.
1616

17-
The `TwilioRestClient` looks for `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` inside the current environment.
18-
19-
### Making a Call
17+
We suggest storing your credentials as environment variables. Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.
2018

2119
```python
2220
from twilio.rest import TwilioRestClient
2321

2422
account = "AXXXXXXXXXXXXXXXXX"
2523
token = "YYYYYYYYYYYYYYYYYY"
2624
client = TwilioRestClient(account, token)
27-
28-
call = client.calls.create(to="9991231234", from_="9991231234",
29-
url="http://foo.com/call.xml")
30-
print call.length
31-
print call.sid
3225
```
33-
#### API Credentials
34-
35-
`TwilioRestClient` needs your Twilio credentials. While these can be passed in directly to the constructor (see above), we suggest storing your credentials as environment variables. Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.
3626

37-
The `TwilioRestClient` looks for `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` inside the current environment.
27+
Alternatively, a `TwilioRestClient` constructor without these parameters will look for `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` inside the current environment.
3828

3929
```python
4030
from twilio.rest import TwilioRestClient
4131
client = TwilioRestClient()
4232
```
4333

44-
### Generating TwiML
34+
### Making a Call
35+
36+
```python
37+
from twilio.rest import TwilioRestClient
38+
39+
account = "AXXXXXXXXXXXXXXXXX"
40+
token = "YYYYYYYYYYYYYYYYYY"
41+
client = TwilioRestClient(account, token)
42+
43+
call = client.calls.create(to="9991231234", from_="9991231234", url="http://foo.com/call.xml")
44+
print call.sid
45+
```
46+
47+
48+
### Handling a call using TwiML
4549

46-
To control phone calls, your application need to output TwiML. Use `twilio.twiml..Response` to easily create such responses.
50+
To control phone calls, your application need to output TwiML. Use `twilio.twiml.Response` to easily create such responses.
4751

4852
```python
4953
from twilio import twiml
5054

5155
r = twiml.Response()
52-
r.play("monkey.mp3", loop=5)
56+
r.say("Welcome to twilio!")
5357
print str(r)
5458
```
5559

5660
```xml
5761
<?xml version="1.0" encoding="utf-8"?>
58-
<Response><Play loop="5">monkey.mp3</Play><Response>
62+
<Response><Say>Welcome to twilio!</Say></Response>
5963
```
6064

6165
### Digging Deeper

0 commit comments

Comments
 (0)
0