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.
  • Sync + Async: Provides both sync and async APIs.

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 AppAPI to provide additional functionality allowing applications have their own graphical interface, fulfill requests from different users, and everything else that is necessary to implement full-fledged applications.

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.

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 AppAPIAuthMiddleware, LogLvl, run_app, set_handlers


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


APP = FastAPI(lifespan=lifespan)
APP.add_middleware(AppAPIAuthMiddleware)


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.19.2.tar.gz (78.6 kB view details)

Uploaded Source

Built Distribution

nc_py_api-0.19.2-py3-none-any.whl (99.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nc_py_api-0.19.2.tar.gz
Algorithm Hash digest
SHA256 0b60f412656d3602408e512a2c15dd34f2e9cc8ae0fa21dc78dbf71696fbf6d9
MD5 e4a81f8c4ec904d638c52710cd387e90
BLAKE2b-256 7ef00307a126bd21e3a614521a5f289ebf51bccd4ab2dbc9dfdf8cd11a3f1dc9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nc_py_api-0.19.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4bd5592bee3331d25098499b124e7fef466a5e537fdd2a0aab46c8cc9de81256
MD5 7e830f7e33b1f9da544bfa89879fbc71
BLAKE2b-256 c5f5c50e8ba6e8ea50d4d323d439dc103af3a6cdb6a942f8b91b9c6515c329a0

See more details on using hashes here.

Supported by

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