Skip to main content

nextcloud-client

Async Python clients for the Nextcloud APIs, built on httpx2 and anyio. Supported:

  • Files (WebDAV): read, write, search, tags, versions, trash, comments
  • Calendar and tasks (CalDAV)
  • Contacts (CardDAV)
  • Notes, Deck, Tables, Talk, Mail, News, Collectives, Cookbook, Sharing, Users, Groups and Shopping List

They are the clients behind nextcloud-mcp-server. The clients are released with it and share its version number. Installing them does not pull in the MCP server's dependencies.

pip install nextcloud-client

Usage

import anyio
from httpx2 import BasicAuth

from nextcloud_client import NextcloudClient


async def main():
    nc = NextcloudClient(
        "https://cloud.example.com",
        "alice",
        BasicAuth("alice", "app-password"),
        password="app-password",  # CalDAV builds its own auth from the raw secret
    )
    async for note in nc.notes.get_all_notes():
        print(note["title"])
    print(await nc.webdav.list_directory("/"))


anyio.run(main)

For OAuth, use NextcloudClient.from_token(base_url, token, username).

TLS and connection reuse

import ssl

NextcloudClient(..., verify=ssl.create_default_context(cafile="ca.pem"))
NextcloudClient(..., verify=False)  # self-signed dev instances only
NextcloudClient(..., keepalive=False)  # fresh connection per request

Long Deck comments

Nextcloud rejects comments over 1000 characters (HTTP 400 "Message exceeds allowed character limit of 1000"). create_split_comment posts a longer message as a thread of up to 10 parts, each prefixed (i/N), with parts 2..N replying to part 1:

from nextcloud_client.deck import (
    CommentTooLongToSplitError,
    PartialSplitCommentError,
    split_comment,
)

posted = await nc.deck.create_split_comment(card_id, long_text)  # list[DeckComment]
parts = split_comment(long_text)  # the same parts, without posting

CommentTooLongToSplitError means more than 10 parts would be needed, and nothing was posted. PartialSplitCommentError means a part failed: its posted attribute lists the comments that were posted. Post only the remaining text, with parent_id=posted[0].id, rather than re-sending the whole message. nextcloud_client.comments has the underlying split_message, measured_length and COMMENT_MAX_LENGTH.

Metrics and tracing

The clients have no dependency on prometheus or OpenTelemetry. To observe them, subclass nextcloud_client.instrumentation.Instrumentation and install it:

from nextcloud_client import instrumentation


class Hooks(instrumentation.Instrumentation):
    def on_api_call(self, app, method, status_code, duration): ...


instrumentation.hooks = Hooks()

License

AGPL-3.0-only.

Metadata

Release files for nextcloud-client 0.229.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nextcloud-client 0.229.1
File Size Uploaded Provenance Actions
nextcloud_client-0.229.1.tar.gz 174.4 kB Without provenance Details for nextcloud_client-0.229.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nextcloud-client 0.229.1
File Interpreter ABI Platform Actions
nextcloud_client-0.229.1-py3-none-any.whl Python 3 none any Details for nextcloud_client-0.229.1-py3-none-any.whl

Total release size: 364.0 kB

Release files / nextcloud_client-0.229.1.tar.gz

Download URL nextcloud_client-0.229.1.tar.gz
Size 174.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fbf90f7b9e73774e5a25a044952ea30f73613b934c1f3c915cf19e85dce43580
BLAKE2b-256 checksum
How to use checksums
101f1b4e7ea85ab3d507e8b93339208106c39cb1bfcdb315270c8e03db3c46c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / nextcloud_client-0.229.1-py3-none-any.whl

Download URL nextcloud_client-0.229.1-py3-none-any.whl
Size 189.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a4ead5e7734cf755ce1af72a2989ffdd2e1e0922455d06e5f02c0260a8c5870
BLAKE2b-256 checksum
How to use checksums
c64c1bf9d6866024112ff2928335ee8b1ac6bd5b13b99d126c4cd58ef7fd87f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for nextcloud-client 0.229.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.229.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page