10000 Document `domain.py` · robscc/twilio-python@80cc506 · GitHub
[go: up one dir, main page]

Skip to content

Commit 80cc506

Browse files
author
Doug Black
committed
Document domain.py
1 parent 354ca6b commit 80cc506

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

twilio/domain.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
class Domain(object):
2+
"""
3+
This represents at Twilio API subdomain.
4+
5+
Like, `api.twilio.com` or `lookups.twilio.com'.
6+
"""
27
def __init__(self, twilio):
38
"""
49
:param Twilio twilio:
@@ -8,10 +13,27 @@ def __init__(self, twilio):
813
self.base_url = None
914

1015
def absolute_url(self, uri):
16+
"""
17+
Converts a relative `uri` to an absolute url.
18+
:param string uri: The relative uri to make absolute.
19+
:return: An absolute url (based off this domain)
20+
"""
1121
return '{}/{}'.format(self.base_url.strip('/'), uri.strip('/'))
1222

1323
def request(self, method, uri, params=None, data=None, headers=None,
1424
auth=None, timeout=None, allow_redirects=False):
25+
"""
26+
Makes an HTTP request to this domain.
27+
:param string method: The HTTP method.
28+
:param string uri: The HTTP uri.
29+
:param dict params: Query parameters.
30+
:param object data: The request body.
31+
:param dict headers: The HTTP headers.
32+
:param tuple auth: Basic auth tuple of (username, password)
33+
:param int timeout: The request timeout.
34+
:param bool allow_redirects: True if the client should follow HTTP
35+
redirects.
36+
"""
1537
url = self.absolute_url(uri)
1638
return self.twilio.request(
1739
method,

0 commit comments

Comments
 (0)
0