Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion boxsdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@
class Client(object):

def __init__(self, oauth, network_layer=None):
network_layer = network_layer if network_layer else DefaultNetwork()
"""
:param oauth:
OAuth2 object used by the session to authorize requests.
:type oauth:
:class:`OAuth2`
:param network_layer:
The Network layer to use. If none is provided then an instance of :class:`DefaultNetwork` will be used.
:type network_layer:
:class:`Network`
"""
network_layer = network_layer or DefaultNetwork()
self._session = BoxSession(oauth=oauth, network_layer=network_layer)

def folder(self, folder_id):
Expand Down
48 changes: 48 additions & 0 deletions boxsdk/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@ class BoxAPIException(BoxException):
Exception raised from the box session layer.
"""
def __init__(self, status, code=None, message=None, request_id=None, headers=None, url=None, method=None):
"""
:param status:
HTTP status code of the failed response
:type status:
`int`
:param code:
The 'code' field of the failed response
:type code:
`unicode`
:param message:
A message to associate with the exception, e.g. 'message' field of the json in the failed response
:type message:
`unicode`
:param request_id:
The 'request_id' field of the json in the failed response
:type request_id:
`unicode`
:param headers:
The HTTP headers in the failed response
:type headers:
`dict`
:param url:
The url which raised the exception
:type url:
`unicode`
:param method:
The HTTP verb used to make the request.
:type method:
`unicode`
"""
super(BoxAPIException, self).__init__()
self._status = status
self._code = code
Expand Down Expand Up @@ -94,6 +124,24 @@ class BoxOAuthException(BoxException):
Exception raised during auth.
"""
def __init__(self, status, message=None, url=None, method=None):
"""
:param status:
HTTP status code of the auth response
:type status:
`int`
:param message:
A message to associate with the exception, e.g. HTTP content of the auth response
:type message:
`unicode`
:param url:
The url which raised the exception
:type url:
`unicode`
:param method:
The HTTP verb used to make the request.
:type method:
`unicode`
"""
super(BoxOAuthException, self).__init__()
self._status = status
self._message = message
Expand Down