Asynchronous Python client for Python Seafile.
About
An asynchronous Python client for the Seafile Web API, built for the Home Assistant Seafile integration. It covers the documented Seafile Web API (checked against Seafile 14), plus the system admin API:
| Area | Examples |
|---|---|
| Account | server info, account and quota, profile, avatar, devices, activities, notifications, guest invitations |
| Libraries | create, rename, transfer, delete, encryption passwords, history and snapshots, trash, deleted libraries, library API tokens and all via-repo-token endpoints |
| Files | directories, file operations, streaming upload (optionally in chunks) and download, file history, batch copy/move/delete, zip download, smart links, starred items |
| Sharing | share links, upload links, sharing with users and groups, folder permissions |
| Groups | groups, members, group libraries; departments and organizations (Pro / multi-tenancy) |
| Admin | system info, statistics, users, libraries, trash, devices, links, groups, logs, notifications |
| Extras | search, tags, file comments, wikis, metadata (Seafile 13+) |
Endpoints that only exist in the Professional edition, or that need a server setting, raise SeafilePermissionError or SeafileNotFoundError on servers without them.
Installation
pip install aioseafile
Example
import asyncio
from aioseafile import Seafile
async def main() -> None:
"""Run the example."""
async with Seafile(api_url="https://cloud.example.com") as seafile:
await seafile.get_auth_token("me@example.com", "password")
account = await seafile.get_account_info()
print(f"{account.usage} of {account.quota_total or 'unlimited'} bytes used")
for library in await seafile.get_libraries():
print(library.name, library.size)
if __name__ == "__main__":
asyncio.run(main())
Pass token= instead of calling get_auth_token to reuse a stored token. Admin methods (get_admin_*, create_admin_*, ...) raise SeafilePermissionError for non-admin accounts.
Uploading and downloading
Uploads and downloads are streamed, so large files never have to fit in memory. Use chunk_size to upload in several requests, for example behind a reverse proxy that limits the request size; each chunk is retried on transient errors.
async def backup(seafile: Seafile, library_id: str, stream: AsyncIterator[bytes], size: int) -> None:
"""Upload a backup and read it back."""
await seafile.create_directory(library_id, "/backups")
await seafile.upload_file(library_id, "/backups", "backup.tar", stream, size=size, chunk_size=50 * 1024 * 1024)
async for chunk in seafile.download_file(library_id, "/backups/backup.tar"):
...
Seafile builds upload and download links from its SERVICE_URL setting, which often differs from the address the client uses. The client rebases these links onto api_url, or onto file_server_url when the file server runs elsewhere.
Contributing
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We've set up a separate document for our contribution guidelines.
Thank you for being involved! 😍
Setting up development environment
The simplest way to begin is by utilizing the Dev Container feature of Visual Studio Code or by opening a CodeSpace directly on GitHub. By clicking the button below you immediately start a Dev Container in Visual Studio Code.
This Python project relies on [UV][poetry] as its dependency manager, providing comprehensive management and control over project dependencies.
Installation
Install all packages, including all development requirements:
uv sync --all-groups && prek install
UV creates by default an virtual environment where it installs all necessary pip packages.
Pre-commit
This repository uses the pre-commit framework, all changes are linted and tested with each commit. To setup the pre-commit check, run:
uv run prek install
And to run all checks and tests manually, use the following command:
uv run prek run --all-files
Testing
It uses pytest as the test framework. To run the tests:
uv run pytest
To update the syrupy snapshot tests:
uv run pytest --snapshot-update
License
MIT License
Copyright (c) 2026 Erwin Douna
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.
Metadata
Release files for aioseafile 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aioseafile-0.1.0.tar.gz | 51.5 kB | With provenance | Details for aioseafile-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aioseafile-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for aioseafile-0.1.0-py3-none-any.whl |
Total release size: 113.4 kB
Release files / aioseafile-0.1.0.tar.gz
| Download URL | aioseafile-0.1.0.tar.gz |
|---|---|
| Size | 51.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7f9f59dd7b705c2c9c40440255f533f3c4a4499f3bf7590ec0a529693bef6e1
|
|
BLAKE2b-256 checksum How to use checksums |
63b9083b576ec4ee0ba5ddd3ca131f9ba49e2c127d3f8b3d4c79ee56a82f6f15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / aioseafile-0.1.0-py3-none-any.whl
| Download URL | aioseafile-0.1.0-py3-none-any.whl |
|---|---|
| Size | 61.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99c16e6019b6c23bb89229a109c5608ea728476a0c7c0b0438b91f42c98de174
|
|
BLAKE2b-256 checksum How to use checksums |
9af902e9525dca77db599574aebc8c010a01ee079d6136dcf1a9b8ba7385d7d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for aioseafile 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for aioseafile-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.