8000 Migrate readme to rst and load it in with setup.py (#417) · twilio/twilio-python@429e53a · GitHub
[go: up one dir, main page]

Skip to content

Commit 429e53a

Browse files
authored
Migrate readme to rst and load it in with setup.py (#417)
* Migrate readme to rst and load it in with setup.py * Add images back and convert smartquotes back
1 parent 320e391 commit 429e53a

File tree

3 files changed

+161
-140
lines changed

3 files changed

+161
-140
lines changed

README.md

Lines changed: 0 additions & 129 deletions
This file was deleted.

README.rst

Lines changed: 156 additions & 0 deletions
< 741A /tr> FA13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
twilio-python
2+
=============
3+
4+
.. image:: https://secure.travis-ci.org/twilio/twilio-python.png?branch=master
5+
:target: http://travis-ci.org/twilio/twilio-python
6+
.. image:: https://img.shields.io/pypi/v/twilio.svg
7+
:target: https://pypi.python.org/pypi/twilio
8+
.. image:: https://img.shields.io/pypi/pyversions/twilio.svg
9+
:target: https://pypi.python.org/pypi/twilio
10+
11+
A module for using the Twilio REST API and generating valid
12+
`TwiML <http://www.twilio.com/docs/api/twiml/>`__.
13+
14+
Recent Update
15+
-------------
16+
17+
As of release 6.5.0, Beta and Developer Preview products are now exposed
18+
via the main ``twilio-python`` artifact. Releases of the ``alpha``
19+
branch have been discontinued.
20+
21+
If you were using the ``alpha`` release line, you should be able to
22+
switch back to the normal release line without issue.
23+
24+
If you were using the normal release line, you should now see several
25+
new product lines that were historically hidden from you due to their
26+
Beta or Developer Preview status. Such products are explicitly
27+
documented as Beta/Developer Preview both in the Twilio docs and
28+
console, as well as through in-line code documentation here in the
29+
library.
30+
31+
Installation
32+
------------
33+
34+
Install from PyPi using
35+
`pip <http://www.pip-installer.org/en/latest/>`__, a package manager for
36+
Python.
37+
38+
::
39+
40+
pip install twilio
41+
42+
Don't have pip installed? Try installing it, by running this from the
43+
command line:
44+
45+
::
46+
47+
$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
48+
49+
Or, you can `download the source code
50+
(ZIP) <https://github.com/twilio/twilio-python/zipball/master>`__ for
51+
``twilio-python``, and then run:
52+
53+
::
54+
55+
python setup.py install
56+
57+
You may need to run the above commands with ``sudo``.
58+
59+
Migrate from 5.x
60+
~~~~~~~~~~~~~~~~
61+
62+
Please consult the `official migration
63+
guide <https://www.twilio.com/docs/libraries/python/migration-guide>`__
64+
for information on upgrading your application using twilio-python 5.x to
65+
6.x
66+
67+
Feedback
68+
--------
69+
70+
Report any feedback or problems with this Release Candidate to the
71+
`Github Issues <https://github.com/twilio/twilio-python/issues>`__ for
72+
twilio-python.
73+
74+
Getting Started
75+
---------------
76+
77+
Getting started with the Twilio API couldn't be easier. Create a
78+
``Client`` and you're ready to go.
79+
80+
API Credentials
81+
~~~~~~~~~~~~~~~
82+
83+
The ``Twilio`` needs your Twilio credentials. You can either pass these
84+
directly to the constructor (see the code below) or via environment
85+
variables.
86+
87+
.. code:: python
88+
89+
from twilio.rest import Client
90+
91+
account = "ACXXXXXXXXXXXXXXXXX"
92+
token = "YYYYYYYYYYYYYYYYYY"
93+
client = Client(account, token)
94+
95+
Alternately, a ``Client`` constructor without these parameters will look
96+
for ``TWILIO_ACCOUNT_SID`` and ``TWILIO_AUTH_TOKEN`` variables inside
97+
the current environment.
98+
99+
We suggest storing your credentials as environment variables. Why?
100+
You'll never have to worry about committing your credentials and
101+
accidentally posting them somewhere public.
102+
103+
.. code:: python
104+
105+
from twilio.rest import Client
106+
client = Client()
107+
108+
Make a Call
109+
~~~~~~~~~~~
110+
111+
.. code:: python
112+
113+
from twilio.rest import Client
114+
115+
account = "ACXXXXXXXXXXXXXXXXX"
116+
token = "YYYYYYYYYYYYYYYYYY"
117+
client = Client(account, token)
118+
119+
call = client.calls.create(to="9991231234",
120+
from_="9991231234",
121+
url="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
122+
print(call.sid)
123+
124+
Send an SMS
125+
~~~~~~~~~~~
126+
127+
.. code:: python
128+
129+
from twilio.rest import Client
130+
131+
account = "ACXXXXXXXXXXXXXXXXX"
132+
token = "YYYYYYYYYYYYYYYYYY"
133+
client = Client(account, token)
134+
135+
message = client.messages.create(to="+12316851234", from_="+15555555555",
136+
body="Hello there!")
137+
138+
Handling a call using TwiML
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
141+
To control phone calls, your application needs to output
142+
`TwiML <http://www.twilio.com/docs/api/twiml/>`__. Use
143+
``twilio.twiml.Response`` to easily create such responses.
144+
145+
.. code:: python
146+
147+
from twilio.twiml.voice_response import VoiceResponse
148+
149+
r = VoiceResponse()
150+
r.say("Welcome to twilio!")
151+
print(str(r))
152+
153+
.. code:: xml
154+
155+
<?xml version="1.0" encoding="utf-8"?>
156+
<Response><Say>Welcome to twilio!</Say></Response>

setup.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
with open('twilio/__init__.py') as f:
77
exec(f.read())
88

9+
with open('README.rst') as f:
10+
long_description = f.read()
11+
912
# To install the twilio-python library, open a Terminal shell, then run this
1013
# file by typing:
1114
#
@@ -51,14 +54,5 @@
5154
"Topic :: Software Development :: Libraries :: Python Modules",
5255
"Topic :: Communications :: Telephony",
5356
],
54-
long_description = """\
55-
Python Twilio Helper Library
56-
----------------------------
57-
58-
DESCRIPTION
59-
The Twilio REST SDK simplifies the process of making calls using the Twilio REST API.
60-
The Twilio REST API lets to you initiate outgoing calls, list previous calls,
61-
and much more. See https://www.github.com/twilio/twilio-python for more information.
62-
63-
LICENSE The Twilio Python Helper Library is distributed under the MIT
64-
License """ )
57+
long_description = long_description
58+
)

0 commit comments

Comments
 (0)
0