Skip to content

Conversation

@kelseymorris95
Copy link
Contributor

Includes proof of concept from https://github.com/Jeff-Meadows/box-python-sdk/tree/api_wrapper. New api_call decorator can be used to allow methods that make an API call to accept an extra parameter, to be used for sending low level request parameters to Requests or whatever network layer is being used.

Kelsey Morris added 29 commits July 26, 2016 11:42
- Decorate Folder's methods with api_call
- Implement clone in BaseObject
- Decorate Folder's methods with api_call
- Implement clone in BaseObject
@boxcla
Copy link

boxcla commented Aug 1, 2016

Verified that @kelseymorris95 has signed the CLA. Thanks for the pull request!

from ..object.file import File
from ..object.group import Group
from ..object.group_membership import GroupMembership
from ..object.cloneable import Cloneable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetize

@Jeff-Meadows
Copy link
Contributor

👍

different session member if desired.
"""

def __init__(self, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This override isn't necessary, since all it does is call super.

Kelsey Morris added 4 commits August 16, 2016 09:54
Moved as_user() and with_shared_link() implementations to Cloneable,
added session propertry.

def with_shared_link(self, shared_link, shared_link_password):
"""
Returns a new endpoint object with default headers set up to make requests using the shared link for auth.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx needs blank lines between the title, and the rest of the docstring.

This is fine for now, but we should probably do a test run of sphinx, and fix all the errors, before doing a release.

@jmoldow
Copy link
Contributor

jmoldow commented Aug 17, 2016

Looks good to me! There are a few minor things I pointed out here, but we can deal with them in another PR. 👍

@jmoldow jmoldow merged commit 6199de8 into master Aug 17, 2016
@jmoldow jmoldow deleted the cloneable branch August 17, 2016 15:56
return self.__class__(self._oauth, self._network_layer, headers, self._default_network_request_kwargs.copy())

def with_default_network_request_kwargs(self, extra_network_parameters):
return self.__class__(self._oauth, self._network_layer, self._default_headers.copy(), extra_network_parameters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's chat about this later:

Since this is the only way for objects to specify request_kwargs, I think it makes more sense for this to be called with_network_request_kwargs (drop the default).

I also feel like the default behavior should be to update any existing arguments, not replace them. Otherwise, it's sort of a last-call-wins, and the "default" arguments only have a meaning if there are no more calls to this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants