boxsdk.session package¶
Submodules¶
boxsdk.session.box_request module¶
-
class
boxsdk.session.box_request.BoxRequest(url, method=u'GET', headers=NOTHING, auto_session_renewal=True, expect_json_response=True)[source]¶ Bases:
objectRepresents a Box API request.
Parameters: - url (unicode) – The URL being requested.
- method (unicode or None) – The HTTP method to use for the request.
- headers (dict or None) – HTTP headers to include with the request.
- auto_session_renewal (bool or None) – Whether or not the session can be automatically renewed if the request fails.
- expect_json_response (bool or None) – Whether or not the API response must be JSON.
-
auto_session_renewal¶
-
expect_json_response¶
-
headers¶
-
method¶
-
url¶
boxsdk.session.box_response module¶
-
class
boxsdk.session.box_response.BoxResponse(network_response)[source]¶ Bases:
objectRepresents a response to a Box API request.
-
content¶ Return the content of the response body.
Return type: varies
-
headers¶ Get the response headers.
Return type: dict
-
network_response¶ Return the underlying network response.
Return type: NetworkResponse
-
ok¶ Return whether or not the request was successful.
Return type: bool
-
status_code¶ Return the HTTP status code of the response.
Return type: int
-
boxsdk.session.session module¶
-
class
boxsdk.session.session.AuthorizedSession(oauth, **kwargs)[source]¶ Bases:
boxsdk.session.session.SessionBox API authorized session. Provides auth, automatic retry of failed requests, and session renewal.
-
class
boxsdk.session.session.Session(network_layer=None, default_headers=None, translator=None, default_network_request_kwargs=None, api_config=None, client_config=None)[source]¶ Bases:
objectBox API session. Provides automatic retry of failed requests.
-
api_config¶ Return type: API
-
as_user(user)[source]¶ Returns a new session object with default headers set up to make requests as the specified user.
Parameters: user ( User) – The user to impersonate when making API requests.
-
box_request_constructor¶ Get the constructor for the container class representing an API request
-
box_response_constructor¶ Get the constructor for the container class representing an API response
-
client_config¶ Return type: Client
-
delete(url, **kwargs)[source]¶ Make a DELETE request to the Box API.
Parameters: url (unicode) – The URL for the request.
-
get(url, **kwargs)[source]¶ Make a GET request to the Box API.
Parameters: url (unicode) – The URL for the request.
-
get_url(endpoint, *args)[source]¶ Return the URL for the given Box API endpoint.
Parameters: - endpoint (url) – The name of the endpoint.
- args (Iterable) – Additional parts of the endpoint URL.
Return type: unicode
-
options(url, **kwargs)[source]¶ Make an OPTIONS request to the Box API.
Parameters: url (unicode) – The URL for the request.
-
post(url, **kwargs)[source]¶ Make a POST request to the Box API.
Parameters: url (unicode) – The URL for the request.
-
put(url, **kwargs)[source]¶ Make a PUT request to the Box API.
Parameters: url (unicode) – The URL for the request.
-
request(method, url, **kwargs)[source]¶ Make a request to the Box API.
Parameters: - method (unicode) – The HTTP verb for the request.
- url (unicode) – The URL for the request.
-
translator¶ The translator used for translating Box API JSON responses into BaseAPIJSONObject smart objects.
Return type: Translator
Returns a new session object with default headers set up to make requests using the shared link for auth.
Parameters: - shared_link (unicode) – The shared link.
- shared_link_password (unicode) – The password for the shared link.
-