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

Support timeout arguments for all method using requests #262

Open
Jasonnor opened this issue Mar 23, 2021 · 0 comments
Open

Support timeout arguments for all method using requests #262

Jasonnor opened this issue Mar 23, 2021 · 0 comments

Comments

@Jasonnor
Copy link

Issue description

Without a timeout, our code may hang for minutes or more.

(For example, the owncloud URL is set incorrectly or the service is unavailable)

Possible solutions

Set a timeout argument in Client class and pass it in all method using requests.

class Client(object):
    def __init__(self, url, **kwargs):
        ...
        self._timeout = kwargs.get('timeout', None)

    def _make_ocs_request(self, method, service, action, **kwargs):
        ...
        res = self._session.request(method, self.url + path, timeout=self._timeout, **attributes)
        return res

If you don’t mind, I can open a pull request to solve it.

qdii added a commit to qdii/pyocclient that referenced this issue Nov 4, 2023
The default behavior of the module requests is to set no time out on the
requests. When a server does not reply to a request, it may cause the
library to hang indefinitely.

Fixes owncloud#262
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

No branches or pull requests

1 participant