You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may need to run the above commands with `sudo`.
8
26
9
27
## Getting Started
10
28
11
-
Getting started with the Twilio API couldn't be easier. Create a `TwilioRestClient` and you're ready to go.
29
+
Getting started with the Twilio API couldn't be easier. Create a
30
+
`TwilioRestClient` and you're ready to go.
12
31
13
32
### API Credentials
14
33
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.
16
-
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.
34
+
The `TwilioRestClient` needs your Twilio credentials. You can either pass these
35
+
directly to the constructor (see the code below) or via environment variables.
18
36
19
37
```python
20
38
from twilio.rest import TwilioRestClient
21
39
22
-
account ="AXXXXXXXXXXXXXXXXX"
40
+
account ="ACXXXXXXXXXXXXXXXXX"
23
41
token ="YYYYYYYYYYYYYYYYYY"
24
42
client = TwilioRestClient(account, token)
25
43
```
26
44
27
-
Alternatively, a `TwilioRestClient` constructor without these parameters will look for `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` inside the current environment.
45
+
Alternately, a `TwilioRestClient` constructor without these parameters will
46
+
look for `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` variables inside the
47
+
current environment.
48
+
49
+
We suggest storing your credentials as environment variables. Why? You'll never
50
+
have to worry about committing your credentials and accidentally posting them
Language"). Use `twilio.twiml.Response` to easily create such responses.
51
91
52
92
```python
53
93
from twilio import twiml
@@ -64,4 +104,7 @@ print str(r)
64
104
65
105
### Digging Deeper
66
106
67
-
The full power of the Twilio API is at your finger tips. The [full documentation](http://readthedocs.org/docs/twilio-python/en/latest/) explains all the awesome features available to use.
107
+
The full power of the Twilio API is at your fingertips. The [full
Copy file name to clipboardExpand all lines: docs/getting-started.rst
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Quickstart
4
4
5
5
Getting started with the Twilio API couldn't be easier. Create a Twilio REST client to get started. For example, the following code makes a call using the Twilio REST API.
Copy file name to clipboardExpand all lines: docs/index.rst
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,13 @@ Installation
11
11
12
12
.. code-block:: bash
13
13
14
-
pip install twilio
14
+
$ pip install twilio
15
15
16
-
You can also download the source and install using :data:`setuptools`
16
+
You can also `download the source <https://github.com/twilio/twilio-python/zipball/master>`_ and install by downloading :data:`setuptools`, navigating in the Terminal to the folder containing the **twilio-python** library, and then running:
17
17
18
18
.. code-block:: bash
19
19
20
-
python setup.py install
20
+
$ python setup.py install
21
21
22
22
Getting Started
23
23
================
@@ -74,12 +74,15 @@ Small functions useful for validating requests are coming from Twilio
74
74
Upgrade Plan
75
75
==================
76
76
77
-
`twilio-python` 3.0 introduced backwards-incompatible changes to the API. See the :doc:`/upgrade-guide` for step-by-step instructions for migrating to 3.0. In many cases, the same methods are still offered, just in different locations.
77
+
`twilio-python` 3.0 introduced backwards-incompatible changes to the API. See
78
+
the :doc:`/upgrade-guide` for step-by-step instructions for migrating to 3.0.
79
+
In many cases, the same methods are still offered, just in different locations.
78
80
79
81
API Reference
80
82
==================
81
83
82
-
A complete guide to all public APIs found in `twilio-python`. Auto-generated, so only use when you really need to dive deep into the library.
84
+
A complete guide to all public APIs found in `twilio-python`. Auto-generated,
85
+
so only use when you really need to dive deep into the library.
83
86
84
87
.. toctree::
85
88
:maxdepth:2
@@ -92,11 +95,11 @@ All development occurs over on `Github <https://github.com/twilio/twilio-python>
:class:`Response` has moved into the :mod:`twiml` module. The `add*` methods have also been deprecated in favor of method names without the 'add' prefix (as shown below).
81
+
:class:`Response` has moved into the :mod:`twiml` module. The `add*` methods
82
+
have also been deprecated in favor of method names without the 'add' prefix (as
83
+
shown below).
82
84
83
85
Here is how you would craft a response using the old library.
84
86
@@ -90,7 +92,7 @@ Here is how you would craft a response using the old library.
The :class:`Utils` class has been renamed to :class:`TwilioValidation` in the :mod:`twilio.util` module and the :meth:`validateRequest` method has been renamed :meth:`validate`.
131
+
The :class:`Utils` class has been renamed to :class:`TwilioValidation` in the
132
+
:mod:`twilio.util` module and the :meth:`validateRequest` method has been
133
+
renamed :meth:`validate`.
129
134
130
135
A sample using the old version of **twilio-python**.
131
136
@@ -138,10 +143,14 @@ A sample using the old version of **twilio-python**.
138
143
139
144
utils = twilio.Utils(ACCOUNT_SID, ACCOUNT_TOKEN)
140
145
146
+
# the callback URL you provided to Twilio for the phone number/app
141
147
url ="http://UUUUUUUUUUUUUUUUUU"
148
+
149
+
the POST variables attached to the request (e.g. "From", "To")
142
150
post_vars = {}
143
151
144
-
signature ="SSSSSSSSSSSSSSSSSSSSSSSSSSSS"
152
+
# X-Twilio-Signature header value
153
+
signature ="HpS7PBa1Agvt4OtO+wZp75IuQa0="# will look something like that
145
154
146
155
if utils.validateRequest(url, post_vars, signature):
147
156
print"was confirmed to have come from Twilio."
@@ -158,12 +167,17 @@ The same sample, converted to use the new version.
158
167
159
168
utils = util.RequestValidator(ACCOUNT_TOKEN)
160
169
161
-
url ="http://UUUUUUUUUUUUUUUUUU"
170
+
# the callback URL you provided to Twilio
171
+
url ="http://www.example.com/my/callback/url.xml"
172
+
173
+
# the POST variables attached to the request (eg "From", "To")
162
174
post_vars = {}
163
175
164
-
signature ="SSSSSSSSSSSSSSSSSSSSSSSSSSSS"
176
+
# X-Twilio-Signature header value
177
+
signature ="HpS7PBa1Agvt4OtO+wZp75IuQa0="# will look something like that
0 commit comments