Skip to main content

Nextcloud Python Framework

Project description

NcPyApi logo

Nextcloud Python Framework

Analysis & Coverage Docs codecov

NextcloudVersion PythonVersion impl pypi

Python library that provides a robust and well-documented API that allows developers to interact with and extend Nextcloud's functionality.

The key features are:

  • Fast: High performance, and as low-latency as possible.
  • Intuitive: Fast to code, easy to use.
  • Reliable: Minimum number of incompatible changes.
  • Robust: All code is covered with tests as much as possible.
  • Easy: Designed to be easy to use with excellent documentation.

Capabilities

Capability Nextcloud 26 Nextcloud 27 Nextcloud 28
Calendar
File System & Tags
Nextcloud Talk
Notifications
Shares
Users & Groups
User & Weather status
Other APIs***
Talk Bot API* N/A
Text Processing* N/A
SpeechToText* N/A

*available only for NextcloudApp
***Activity, Notes

Differences between the Nextcloud and NextcloudApp classes

The Nextcloud class functions as a standard Nextcloud client, enabling you to make API requests using a username and password.

On the other hand, the NextcloudApp class is designed for creating applications for Nextcloud.
It uses the AppAPI to allow applications to impersonate users through a separate authentication mechanism.

Both classes offer most of the same APIs, but NextcloudApp has a broader selection since applications typically require access to more APIs.

Any code written for the Nextcloud class can easily be adapted for use with the NextcloudApp class, as long as it doesn't involve calls that require user password verification.

NextcloudApp avalaible only from Nextcloud 27.1.2 and greater version with installed AppAPI.

Nextcloud skeleton app in Python

from contextlib import asynccontextmanager

from fastapi import FastAPI

from nc_py_api import NextcloudApp
from nc_py_api.ex_app import LogLvl, run_app, set_handlers


@asynccontextmanager
async def lifespan(_app: FastAPI):
    set_handlers(APP, enabled_handler)
    yield


APP = FastAPI(lifespan=lifespan)


def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
    if enabled:
        nc.log(LogLvl.WARNING, "Hello from nc_py_api.")
    else:
        nc.log(LogLvl.WARNING, "Bye bye from nc_py_api.")
    return ""


if __name__ == "__main__":
    run_app("main:APP", log_level="trace")

Support

You can support us in several ways:

  • ⭐️ Star our work (it really motivates)
  • ❗️ Create an Issue or feature request (bring to us an excellent idea)
  • 💁 Resolve some Issue or create a Pull Request (contribute to this project)
  • 🙏 Write an example of its use or correct a typo in the documentation.

More Information

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nc_py_api-0.5.0.tar.gz (59.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nc_py_api-0.5.0-py3-none-any.whl (71.1 kB view details)

Uploaded Python 3

File details

Details for the file nc_py_api-0.5.0.tar.gz.

File metadata

  • Download URL: nc_py_api-0.5.0.tar.gz
  • Upload date:
  • Size: 59.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for nc_py_api-0.5.0.tar.gz
Algorithm Hash digest
SHA256 328ac7b6924570698954690f29efed17298a42e69ad9cc6f3738098ca80909a2
MD5 0ff53733d17bc5a4fb78dcac3028ca0d
BLAKE2b-256 c79c509c9c6780985de389621a56281fff480d344a122db12a1265ecae0e47bf

See more details on using hashes here.

File details

Details for the file nc_py_api-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: nc_py_api-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 71.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for nc_py_api-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c77b51fae7aa2edff0be67c9ebaa95c5e2a36a91e154d1613ed1e66b400f9060
MD5 ac5c5cad1a1cd702a788019c52caa772
BLAKE2b-256 71bcadfe44e48111316870517408052c048f200946d13f38a58bee156f39d7c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page