nc-py-api


Namenc-py-api JSON
Version 0.13.0 PyPI version JSON
download
home_pageNone
SummaryNextcloud Python Framework
upload_time2024-04-28 07:53:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords api client framework library nextcloud
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <img src="https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/docs/resources/nc_py_api_logo.png" width="250" alt="NcPyApi logo">
</p>

# Nextcloud Python Framework

[![Analysis & Coverage](https://github.com/cloud-py-api/nc_py_api/actions/workflows/analysis-coverage.yml/badge.svg)](https://github.com/cloud-py-api/nc_py_api/actions/workflows/analysis-coverage.yml)
[![Docs](https://github.com/cloud-py-api/nc_py_api/actions/workflows/docs.yml/badge.svg)](https://cloud-py-api.github.io/nc_py_api/)
[![codecov](https://codecov.io/github/cloud-py-api/nc_py_api/branch/main/graph/badge.svg?token=C91PL3FYDQ)](https://codecov.io/github/cloud-py-api/nc_py_api)

![NextcloudVersion](https://img.shields.io/badge/Nextcloud-26%20%7C%2027%20%7C%2028-blue)
![PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
![impl](https://img.shields.io/pypi/implementation/nc_py_api)
![pypi](https://img.shields.io/pypi/v/nc_py_api.svg)

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.

### Capabilities
| **_Capability_**      | Nextcloud 26 | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 |
|-----------------------|:------------:|:------------:|:------------:|:------------:|
| Calendar              |      ✅       |      ✅       |      ✅       |      ✅       |
| File System & Tags    |      ✅       |      ✅       |      ✅       |      ✅       |
| Nextcloud Talk        |      ✅       |      ✅       |      ✅       |      ✅       |
| Notifications         |      ✅       |      ✅       |      ✅       |      ✅       |
| Shares                |      ✅       |      ✅       |      ✅       |      ✅       |
| Users & Groups        |      ✅       |      ✅       |      ✅       |      ✅       |
| User & Weather status |      ✅       |      ✅       |      ✅       |      ✅       |
| Other APIs***         |      ✅       |      ✅       |      ✅       |      ✅       |
| Talk Bot API*         |     N/A      |      ✅       |      ✅       |      ✅       |
| Settings UI API*      |     N/A      |     N/A      |     N/A      |      ✅       |
| AI Providers API**    |     N/A      |     N/A      |     N/A      |      ✅       |

&ast;_available only for **NextcloudApp**_<br>
&ast;&ast;_available only for **NextcloudApp**: SpeechToText, TextProcessing, Translation_<br>
&ast;&ast;&ast;_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.<br>
It uses [AppAPI](https://github.com/cloud-py-api/app_api) 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.

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

### Nextcloud skeleton app in Python

```python3
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

- [Documentation](https://cloud-py-api.github.io/nc_py_api/)
  - [First steps](https://cloud-py-api.github.io/nc_py_api/FirstSteps.html)
  - [More APIs](https://cloud-py-api.github.io/nc_py_api/MoreAPIs.html)
  - [Writing a simple Nextcloud Application](https://cloud-py-api.github.io/nc_py_api/NextcloudApp.html)
  - [Using Nextcloud Talk Bot API in Application](https://cloud-py-api.github.io/nc_py_api/NextcloudTalkBot.html)
  - [Using Language Models In Application](https://cloud-py-api.github.io/nc_py_api/NextcloudTalkBotTransformers.html)
  - [Writing a Nextcloud System Application](https://cloud-py-api.github.io/nc_py_api/NextcloudSysApp.html)
- [Examples](https://github.com/cloud-py-api/nc_py_api/tree/main/examples)
- [Contribute](https://github.com/cloud-py-api/nc_py_api/blob/main/.github/CONTRIBUTING.md)
  - [Discussions](https://github.com/cloud-py-api/nc_py_api/discussions)
  - [Issues](https://github.com/cloud-py-api/nc_py_api/issues)
  - [Setting up dev environment](https://cloud-py-api.github.io/nc_py_api/DevSetup.html)
- [Changelog](https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nc-py-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "api, client, framework, library, nextcloud",
    "author": null,
    "author_email": "Alexander Piskun <bigcat88@icloud.com>",
    "download_url": "https://files.pythonhosted.org/packages/9e/15/bd94b159888f8d401d809686d38e1480c62883cb42879063a04b17a9e4aa/nc_py_api-0.13.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/docs/resources/nc_py_api_logo.png\" width=\"250\" alt=\"NcPyApi logo\">\n</p>\n\n# Nextcloud Python Framework\n\n[![Analysis & Coverage](https://github.com/cloud-py-api/nc_py_api/actions/workflows/analysis-coverage.yml/badge.svg)](https://github.com/cloud-py-api/nc_py_api/actions/workflows/analysis-coverage.yml)\n[![Docs](https://github.com/cloud-py-api/nc_py_api/actions/workflows/docs.yml/badge.svg)](https://cloud-py-api.github.io/nc_py_api/)\n[![codecov](https://codecov.io/github/cloud-py-api/nc_py_api/branch/main/graph/badge.svg?token=C91PL3FYDQ)](https://codecov.io/github/cloud-py-api/nc_py_api)\n\n![NextcloudVersion](https://img.shields.io/badge/Nextcloud-26%20%7C%2027%20%7C%2028-blue)\n![PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)\n![impl](https://img.shields.io/pypi/implementation/nc_py_api)\n![pypi](https://img.shields.io/pypi/v/nc_py_api.svg)\n\nPython library that provides a robust and well-documented API that allows developers to interact with and extend Nextcloud's functionality.\n\n### The key features are:\n * **Fast**: High performance, and as low-latency as possible.\n * **Intuitive**: Fast to code, easy to use.\n * **Reliable**: Minimum number of incompatible changes.\n * **Robust**: All code is covered with tests as much as possible.\n * **Easy**: Designed to be easy to use with excellent documentation.\n * **Sync + Async**: Provides both sync and async APIs.\n\n### Capabilities\n| **_Capability_**      | Nextcloud 26 | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 |\n|-----------------------|:------------:|:------------:|:------------:|:------------:|\n| Calendar              |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| File System & Tags    |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Nextcloud Talk        |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Notifications         |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Shares                |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Users & Groups        |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| User & Weather status |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Other APIs***         |      \u2705       |      \u2705       |      \u2705       |      \u2705       |\n| Talk Bot API*         |     N/A      |      \u2705       |      \u2705       |      \u2705       |\n| Settings UI API*      |     N/A      |     N/A      |     N/A      |      \u2705       |\n| AI Providers API**    |     N/A      |     N/A      |     N/A      |      \u2705       |\n\n&ast;_available only for **NextcloudApp**_<br>\n&ast;&ast;_available only for **NextcloudApp**: SpeechToText, TextProcessing, Translation_<br>\n&ast;&ast;&ast;_Activity, Notes_\n\n### Differences between the Nextcloud and NextcloudApp classes\n\nThe **Nextcloud** class functions as a standard Nextcloud client,\nenabling you to make API requests using a username and password.\n\nOn the other hand, the **NextcloudApp** class is designed for creating applications for Nextcloud.<br>\nIt uses [AppAPI](https://github.com/cloud-py-api/app_api) to provide additional functionality allowing\napplications have their own graphical interface, fulfill requests from different users,\nand everything else that is necessary to implement full-fledged applications.\n\nBoth classes offer most of the same APIs,\nbut NextcloudApp has a broader selection since applications typically require access to more APIs.\n\nAny code written for the Nextcloud class can easily be adapted for use with the NextcloudApp class,\nas long as it doesn't involve calls that require user password verification.\n\n**NextcloudApp** avalaible only from Nextcloud 27.1.2 and greater version with installed **AppAPI**.\n\n### Nextcloud skeleton app in Python\n\n```python3\nfrom contextlib import asynccontextmanager\n\nfrom fastapi import FastAPI\n\nfrom nc_py_api import NextcloudApp\nfrom nc_py_api.ex_app import AppAPIAuthMiddleware, LogLvl, run_app, set_handlers\n\n\n@asynccontextmanager\nasync def lifespan(app: FastAPI):\n    set_handlers(app, enabled_handler)\n    yield\n\n\nAPP = FastAPI(lifespan=lifespan)\nAPP.add_middleware(AppAPIAuthMiddleware)\n\n\ndef enabled_handler(enabled: bool, nc: NextcloudApp) -> str:\n    if enabled:\n        nc.log(LogLvl.WARNING, \"Hello from nc_py_api.\")\n    else:\n        nc.log(LogLvl.WARNING, \"Bye bye from nc_py_api.\")\n    return \"\"\n\n\nif __name__ == \"__main__\":\n    run_app(\"main:APP\", log_level=\"trace\")\n```\n\n### Support\n\nYou can support us in several ways:\n\n- \u2b50\ufe0f Star our work (it really motivates)\n- \u2757\ufe0f Create an Issue or feature request (bring to us an excellent idea)\n- \ud83d\udc81 Resolve some Issue or create a Pull Request (contribute to this project)\n- \ud83d\ude4f Write an example of its use or correct a typo in the documentation.\n\n## More Information\n\n- [Documentation](https://cloud-py-api.github.io/nc_py_api/)\n  - [First steps](https://cloud-py-api.github.io/nc_py_api/FirstSteps.html)\n  - [More APIs](https://cloud-py-api.github.io/nc_py_api/MoreAPIs.html)\n  - [Writing a simple Nextcloud Application](https://cloud-py-api.github.io/nc_py_api/NextcloudApp.html)\n  - [Using Nextcloud Talk Bot API in Application](https://cloud-py-api.github.io/nc_py_api/NextcloudTalkBot.html)\n  - [Using Language Models In Application](https://cloud-py-api.github.io/nc_py_api/NextcloudTalkBotTransformers.html)\n  - [Writing a Nextcloud System Application](https://cloud-py-api.github.io/nc_py_api/NextcloudSysApp.html)\n- [Examples](https://github.com/cloud-py-api/nc_py_api/tree/main/examples)\n- [Contribute](https://github.com/cloud-py-api/nc_py_api/blob/main/.github/CONTRIBUTING.md)\n  - [Discussions](https://github.com/cloud-py-api/nc_py_api/discussions)\n  - [Issues](https://github.com/cloud-py-api/nc_py_api/issues)\n  - [Setting up dev environment](https://cloud-py-api.github.io/nc_py_api/DevSetup.html)\n- [Changelog](https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Nextcloud Python Framework",
    "version": "0.13.0",
    "project_urls": {
        "Changelog": "https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md",
        "Documentation": "https://cloud-py-api.github.io/nc_py_api/",
        "Source": "https://github.com/cloud-py-api/nc_py_api"
    },
    "split_keywords": [
        "api",
        " client",
        " framework",
        " library",
        " nextcloud"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "048abe2e6a4b5f6a396eea12f218d29ed99861ff2bde67528eb9e387bf1ab5e8",
                "md5": "8a2b205f09169ee9e3df22c5ca4f2154",
                "sha256": "628c5616fd562addf4badac99c48d00c98b81192311c6bcbfede4149213e3dbb"
            },
            "downloads": -1,
            "filename": "nc_py_api-0.13.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a2b205f09169ee9e3df22c5ca4f2154",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 91507,
            "upload_time": "2024-04-28T07:53:48",
            "upload_time_iso_8601": "2024-04-28T07:53:48.407484Z",
            "url": "https://files.pythonhosted.org/packages/04/8a/be2e6a4b5f6a396eea12f218d29ed99861ff2bde67528eb9e387bf1ab5e8/nc_py_api-0.13.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9e15bd94b159888f8d401d809686d38e1480c62883cb42879063a04b17a9e4aa",
                "md5": "79d3fc3449cf6380f748ad567065afd2",
                "sha256": "2b0eb78852fd321e6ecbf81c0a83b22397799259fdd3998725f9bcc61d550bf5"
            },
            "downloads": -1,
            "filename": "nc_py_api-0.13.0.tar.gz",
            "has_sig": false,
            "md5_digest": "79d3fc3449cf6380f748ad567065afd2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 73663,
            "upload_time": "2024-04-28T07:53:50",
            "upload_time_iso_8601": "2024-04-28T07:53:50.864385Z",
            "url": "https://files.pythonhosted.org/packages/9e/15/bd94b159888f8d401d809686d38e1480c62883cb42879063a04b17a9e4aa/nc_py_api-0.13.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-28 07:53:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cloud-py-api",
    "github_project": "nc_py_api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nc-py-api"
}
        
Elapsed time: 0.23772s