webdavit


Namewebdavit JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA simple async WebDAV client for Python
upload_time2025-09-01 23:20:32
maintainerNone
docs_urlNone
authormerlinz01
requires_python>=3.12
licenseCopyright (c) 2025 Merlin Zimmerman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords webdav async client http aiohttp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WebDAVit

WebDAVit is a simple async WebDAV client for Python.

## Features

- Basic file operations: list, upload, download, mkdir, delete, move, copy, lock.
- Support for authentication.
- Asynchronous operations using `aiohttp` for non-blocking I/O.
- Lightweight and easy to use.

## Installation

You can install WebDAVit using pip:

```bash
pip install webdavit
```

Or, if you're using `uv`, you can add it with:

```bash
uv add webdavit
```

## Usage

Here's a quick overview of how to use WebDAVit:

```python
import asyncio
import io
from webdavit import WebDAVClient

async def example():
    async with WebDAVClient(
            'https://webdav.example.com',
            username='user',
            password='pass',
        ) as client:

        # List files in the root directory
        files = await client.list('/')
        print(files)

        # Upload a file
        await client.upload_file('/path/to/local_file.txt', '/remote_file.txt')
        await client.upload_text('Hello, WebDAV!', '/hello.txt')
        await client.upload_bytes(b'Hello, WebDAV in bytes!', '/hello_bytes.txt')
        await client.upload_stream(io.BytesIO(b'Streaming data!'), '/stream.txt')
        await client.upload_json({'key': 'value'}, '/data.json')

        # Download a file
        await client.download_file('/remote_file.txt', '/path/to/local_file.txt')
        text = await client.download_text('/hello.txt')
        print(text)
        jsondata = await client.download_json('/data.json')
        print(jsondata)
        bytesdata = await client.download_bytes('/hello_bytes.txt')
        print(bytesdata)
        async with client.download_stream('/stream.txt')
            print(await stream.read())

        # Delete a file
        await client.delete('/remote_file.txt')

        # Create a directory
        await client.mkdir('/new_directory')

        # Delete a directory
        # Note that this is a recursive delete
        await client.delete('/new_directory')

        # Move or rename a file
        await client.move('/old_name.txt', '/new_name.txt')

        # Copy a file
        await client.copy('/source.txt', '/destination.txt')

        # Check if a file or directory exists
        exists = await client.exists('/some_path')
        print(f'Exists: {exists}')

        # Get file or directory info
        info = await client.get('/some_path')
        print(info)

        # Lock a file
        async with await client.lock('/some_file.txt', timeout=60) as lock:
            print(f'Lock info: {lock}')
            await client.upload_text(
                'Updated content while locked',
                '/some_file.txt',
                lock_token=lock.token
            )
            # Refresh the lock if needed
            await client.refresh_lock(lock)
            print(f'Refreshed lock info: {lock}')
            # The lock will be released automatically when exiting the context

asyncio.run(example())
```

## License

WebDAVit is licensed under the MIT License.
See the [LICENSE.txt](/LICENSE.txt) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "webdavit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "webdav, async, client, http, aiohttp",
    "author": "merlinz01",
    "author_email": "merlinz01 <158784988+merlinz01@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/83/85/0c05eec49bb20ff9202f54ca5bc2e1f3472d3409a837e176c5c437a94ee9/webdavit-0.1.0.tar.gz",
    "platform": null,
    "description": "# WebDAVit\n\nWebDAVit is a simple async WebDAV client for Python.\n\n## Features\n\n- Basic file operations: list, upload, download, mkdir, delete, move, copy, lock.\n- Support for authentication.\n- Asynchronous operations using `aiohttp` for non-blocking I/O.\n- Lightweight and easy to use.\n\n## Installation\n\nYou can install WebDAVit using pip:\n\n```bash\npip install webdavit\n```\n\nOr, if you're using `uv`, you can add it with:\n\n```bash\nuv add webdavit\n```\n\n## Usage\n\nHere's a quick overview of how to use WebDAVit:\n\n```python\nimport asyncio\nimport io\nfrom webdavit import WebDAVClient\n\nasync def example():\n    async with WebDAVClient(\n            'https://webdav.example.com',\n            username='user',\n            password='pass',\n        ) as client:\n\n        # List files in the root directory\n        files = await client.list('/')\n        print(files)\n\n        # Upload a file\n        await client.upload_file('/path/to/local_file.txt', '/remote_file.txt')\n        await client.upload_text('Hello, WebDAV!', '/hello.txt')\n        await client.upload_bytes(b'Hello, WebDAV in bytes!', '/hello_bytes.txt')\n        await client.upload_stream(io.BytesIO(b'Streaming data!'), '/stream.txt')\n        await client.upload_json({'key': 'value'}, '/data.json')\n\n        # Download a file\n        await client.download_file('/remote_file.txt', '/path/to/local_file.txt')\n        text = await client.download_text('/hello.txt')\n        print(text)\n        jsondata = await client.download_json('/data.json')\n        print(jsondata)\n        bytesdata = await client.download_bytes('/hello_bytes.txt')\n        print(bytesdata)\n        async with client.download_stream('/stream.txt')\n            print(await stream.read())\n\n        # Delete a file\n        await client.delete('/remote_file.txt')\n\n        # Create a directory\n        await client.mkdir('/new_directory')\n\n        # Delete a directory\n        # Note that this is a recursive delete\n        await client.delete('/new_directory')\n\n        # Move or rename a file\n        await client.move('/old_name.txt', '/new_name.txt')\n\n        # Copy a file\n        await client.copy('/source.txt', '/destination.txt')\n\n        # Check if a file or directory exists\n        exists = await client.exists('/some_path')\n        print(f'Exists: {exists}')\n\n        # Get file or directory info\n        info = await client.get('/some_path')\n        print(info)\n\n        # Lock a file\n        async with await client.lock('/some_file.txt', timeout=60) as lock:\n            print(f'Lock info: {lock}')\n            await client.upload_text(\n                'Updated content while locked',\n                '/some_file.txt',\n                lock_token=lock.token\n            )\n            # Refresh the lock if needed\n            await client.refresh_lock(lock)\n            print(f'Refreshed lock info: {lock}')\n            # The lock will be released automatically when exiting the context\n\nasyncio.run(example())\n```\n\n## License\n\nWebDAVit is licensed under the MIT License.\nSee the [LICENSE.txt](/LICENSE.txt) file for details.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2025 Merlin Zimmerman\n         \n         Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n         \n         The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n         \n         THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A simple async WebDAV client for Python",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "webdav",
        " async",
        " client",
        " http",
        " aiohttp"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ffe65d02592d8b594655dc30d546950b1811b62a48748dbb2454552895c6eb70",
                "md5": "e7ca601d167699ec2f27b78344ca02b0",
                "sha256": "de5d929f436d674df99b9d74743c144b5c88e731df9b52032eff433c9bc7048a"
            },
            "downloads": -1,
            "filename": "webdavit-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7ca601d167699ec2f27b78344ca02b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 13942,
            "upload_time": "2025-09-01T23:20:31",
            "upload_time_iso_8601": "2025-09-01T23:20:31.405343Z",
            "url": "https://files.pythonhosted.org/packages/ff/e6/5d02592d8b594655dc30d546950b1811b62a48748dbb2454552895c6eb70/webdavit-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "83850c05eec49bb20ff9202f54ca5bc2e1f3472d3409a837e176c5c437a94ee9",
                "md5": "9dc8da922a495fa3f4ffd86d70432134",
                "sha256": "1935881c2db9c4f9a5b4bf8ca5bf123cda01c922be25ac937df34b99ac051d5d"
            },
            "downloads": -1,
            "filename": "webdavit-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9dc8da922a495fa3f4ffd86d70432134",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 12210,
            "upload_time": "2025-09-01T23:20:32",
            "upload_time_iso_8601": "2025-09-01T23:20:32.941004Z",
            "url": "https://files.pythonhosted.org/packages/83/85/0c05eec49bb20ff9202f54ca5bc2e1f3472d3409a837e176c5c437a94ee9/webdavit-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-01 23:20:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "webdavit"
}
        
Elapsed time: 0.61247s