Skip to content

Commit 2915248

Browse files
committed
Merge pull request #1 from box/doc-strings
Add some missing docstrings.
2 parents 4902ad0 + 7dbbe0e commit 2915248

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

boxsdk/client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@
1818
class Client(object):
1919

2020
def __init__(self, oauth, network_layer=None):
21-
network_layer = network_layer if network_layer else DefaultNetwork()
21+
"""
22+
:param oauth:
23+
OAuth2 object used by the session to authorize requests.
24+
:type oauth:
25+
:class:`OAuth2`
26+
:param network_layer:
27+
The Network layer to use. If none is provided then an instance of :class:`DefaultNetwork` will be used.
28+
:type network_layer:
29+
:class:`Network`
30+
"""
31+
network_layer = network_layer or DefaultNetwork()
2232
self._session = BoxSession(oauth=oauth, network_layer=network_layer)
2333

2434
def folder(self, folder_id):

boxsdk/exception.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,36 @@ class BoxAPIException(BoxException):
2424
Exception raised from the box session layer.
2525
"""
2626
def __init__(self, status, code=None, message=None, request_id=None, headers=None, url=None, method=None):
27+
"""
28+
:param status:
29+
HTTP status code of the failed response
30+
:type status:
31+
`int`
32+
:param code:
33+
The 'code' field of the failed response
34+
:type code:
35+
`unicode`
36+
:param message:
37+
A message to associate with the exception, e.g. 'message' field of the json in the failed response
38+
:type message:
39+
`unicode`
40+
:param request_id:
41+
The 'request_id' field of the json in the failed response
42+
:type request_id:
43+
`unicode`
44+
:param headers:
45+
The HTTP headers in the failed response
46+
:type headers:
47+
`dict`
48+
:param url:
49+
The url which raised the exception
50+
:type url:
51+
`unicode`
52+
:param method:
53+
The HTTP verb used to make the request.
54+
:type method:
55+
`unicode`
56+
"""
2757
super(BoxAPIException, self).__init__()
2858
self._status = status
2959
self._code = code
@@ -94,6 +124,24 @@ class BoxOAuthException(BoxException):
94124
Exception raised during auth.
95125
"""
96126
def __init__(self, status, message=None, url=None, method=None):
127+
"""
128+
:param status:
129+
HTTP status code of the auth response
130+
:type status:
131+
`int`
132+
:param message:
133+
A message to associate with the exception, e.g. HTTP content of the auth response
134+
:type message:
135+
`unicode`
136+
:param url:
137+
The url which raised the exception
138+
:type url:
139+
`unicode`
140+
:param method:
141+
The HTTP verb used to make the request.
142+
:type method:
143+
`unicode`
144+
"""
97145
super(BoxOAuthException, self).__init__()
98146
self._status = status
99147
self._message = message

0 commit comments

Comments
 (0)