Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurations like timeout, proxy, and ssl_verify should be parameterised #885

Open
nikunjcrest opened this issue Dec 2, 2024 · 1 comment

Comments

@nikunjcrest
Copy link

Currently, in the Box SDK, configuring timeout, proxy, and SSL verify requires overriding the DefaultNetwork.request method.

class ProxyableBoxNetwork(DefaultNetwork):
    def __init__(self, proxy_conf, verify, logger=None):
        super(ProxyableBoxNetwork, self).__init__()

    def request(self, method, url, access_token, **kwargs):
        return super(ProxyableBoxNetwork, self).request(
            method, url, access_token,
            proxies=self._proxies,
            verify=self._verify,
            timeout=self._timeout,
            **kwargs
        )

Shouldn't these configurations be parameterised to allow straightforward setup without overriding?

@lukaszsocha2
Copy link
Contributor

Hi,
currently box-python-sdk is in "stable" state, what means that bugs will be fixed but there is no ongoing development of new features. So as long as this can be achieved by overriding the DefaultNetwork.request method we won't implement proposed enhancement.
Our new box Python SDK can be found here: https://github.com/box/box-python-sdk-gen. We are in the process of transitioning to fully generated SDK.
But going back to your issue, there is also another way to achieve this. You could add extra_network_parameters property to any API method and properties from there would be passed directly to request library call. For example to set a timeout for a call you can call:
item.update_info(data=data, extra_network_parameters={'timeout': 1}).
I know this is not ideal, because you have to do it for each call, but maybe you can us somehow.
Best,
@lukaszsocha2

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

No branches or pull requests

7 participants