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

Allow passing arbitrary args to requests #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

damiencorpataux
Copy link

Simple implementation: this is done by adding **kwargs to _send and all its user functions (eg. download, upload, etc.)

Implementation sample:

    def _send(self, method, path, expected_code, **kwargs):
        url = self._get_url(path)
        response = self.session.request(method, url, allow_redirects=False, **kwargs)
        ...
        return response

    def mkdir(self, path, safe=False, **kwargs):
        expected_codes = 201 if not safe else (201, 301, 405)
        self._send('MKCOL', path, expected_codes, **kwargs)

This allows passing args to the underlying requests session:

import webdav
c = webdav.connect(...)
c.exists('/', timeout=2)

This is done by adding **kwargs to _send
and all its user functions (eg. download, upload, etc.)
@joas77
Copy link

joas77 commented Mar 19, 2019

Is this project dead? I think this would be a great improvement

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.

3 participants