8000 Whitespace and more doc stuff · michaelhelmick/twilio-python@3e7e8f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e7e8f3

Browse files
committed
Whitespace and more doc stuff
1 parent b7a3b43 commit 3e7e8f3

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ A complete API reference to the :data:`twilio` module.
1010
api/rest/index
1111
api/rest/resources
1212
api/twiml
13+
api/util
1314

docs/index.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Small functions useful for validating requests are coming from Twilio
6969
:maxdepth: 1
7070

7171
usage/validation
72+
usage/token-generation
7273

7374
Upgrade Plan
7475
==================
@@ -97,12 +98,3 @@ All development occurs over on `Github <https://github.com/twilio/twilio-python>
9798
Report bugs using the Github `issue tracker <https://github.com/twilio/twilio-python/issues>`_.
9899

99100
If you’ve got questions that aren’t answered by this documentation, ask the `#twilio IRC channel <irc://irc.freenode.net/#twilio>`_
100-
101-
Changelog
102-
=================
103-
Current stable version is 3.0.0.
104-
105-
.. toctree::
106-
:maxdepth: 1
107-
108-
changelog

twilio/util.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def compute_signature(self, uri, params):
1818
:param params: post vars that Twilio sent with the request
1919
:param auth: tuple with (account_sid, token)
2020
21-
Returns the computed signature
21+
:returns: The computed signature
2222
"""
2323
s = uri
2424
if len(params) > 0:
@@ -37,25 +37,25 @@ def validate(self, uri, params, signature):
3737
:param signature: expexcted signature in HTTP X-Twilio-Signature header
3838
:param auth: tuple with (account_sid, token)
3939
40-
returns true if the request passes validation, false if not
40+
:ret 8000 urns: True if the request passes validation, False if not
4141
"""
4242
return self.compute_signature(uri, params) == signature
4343

4444

4545
class TwilioCapability(object):
4646
"""
4747
A token to control permissions with Twilio Client
48-
"""
4948
50-
def __init__(self, account_sid, auth_token):
51-
"""Create a new TwilioCapability with zero permissions
49+
:param string account_sid: the account sid to which this token
50+
is granted access
51+
:param string auth_token: the secret key used to sign the token.
52+
Note, this auth token is not visible to the
53+
user of the token.
5254
53-
Arguments:
54-
account_sid -- the account sid to which this token is granted access
55-
auth_token -- the secret key used to sign the token. Note, this auth
56-
token is not visible to the user of the token.
55+
:returns: A new TwilioCapability with zero permissions
56+
"""
5 8000 757

58-
"""
58+
def __init__(self, account_sid, auth_token):
5959
self.account_sid = account_sid
6060
self.auth_token = auth_token
6161
self.capabilities = {}
@@ -71,8 +71,8 @@ def payload(self):
7171
def generate(self, expires=3600):
7272
"""Generate a valid JWT token with an expiration date.
7373
74-
Keyword Arguments:
75-
expires -- The token lifetime, in seconds. Defaults to 1 hour (3600)
74+
:param int expires: The token lifetime, in seconds. Defaults to
75+
1 hour (3600)
7676
7777
"""
7878
payload = self.payload()
@@ -86,9 +86,8 @@ def allow_client_outgoing(self, application_sid,
8686
8787
Keyword arguments are passed to the application.
8888
89-
Arguments:
90-
application_sid -- Application to contact
91-
client_name -- (Optional) used for caller id in client to client
89+
:param string application_sid: Application to contact
90+
:param string client_name: Used for caller id in client to client
9291
9392
"""
9493
scope_params = {
@@ -107,8 +106,7 @@ def allow_client_incoming(self, client_name):
107106
connections then configure the TwilioCapability through this method and
108107
specify the client name.
109108
110-
Arguments:
111-
client_name -- Client name to accept calls from
109+
:param string client_name: Client name to accept calls from
112110
113111
"""
114112
self.capabilities["incoming"] = ScopeURI("client", "incoming", {

0 commit comments

Comments
 (0)
0