<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-27%20%7C%2028%20%7C%2029%20%7C%2030-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 27 | Nextcloud 28 | Nextcloud 29 | Nextcloud 30 |
|------------------------------|:------------:|:------------:|:------------:|:------------:|
| Calendar | ✅ | ✅ | ✅ | ✅ |
| File System & Tags | ✅ | ✅ | ✅ | ✅ |
| Nextcloud Talk | ✅ | ✅ | ✅ | ✅ |
| Notifications | ✅ | ✅ | ✅ | ✅ |
| Shares | ✅ | ✅ | ✅ | ✅ |
| Users & Groups | ✅ | ✅ | ✅ | ✅ |
| User & Weather status | ✅ | ✅ | ✅ | ✅ |
| Other APIs** | ✅ | ✅ | ✅ | ✅ |
| Talk Bot API* | ✅ | ✅ | ✅ | ✅ |
| Settings UI API* | N/A | N/A | ✅ | ✅ |
| TaskProcessing Provider API* | N/A | N/A | N/A | ✅ |
*_available only for **NextcloudApp**_<br>
**_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/51/f7/668ddbcf4764da9b3d6226d726247b010707863293facff88ae2c2504c53/nc_py_api-0.18.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-27%20%7C%2028%20%7C%2029%20%7C%2030-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 27 | Nextcloud 28 | Nextcloud 29 | Nextcloud 30 |\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* | \u2705 | \u2705 | \u2705 | \u2705 |\n| Settings UI API* | N/A | N/A | \u2705 | \u2705 |\n| TaskProcessing Provider API* | N/A | N/A | N/A | \u2705 |\n\n*_available only for **NextcloudApp**_<br>\n**_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.18.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": "95f9304e68d298b54403e16afe9536880abc3c578bc9508737b52d0125abc460",
"md5": "254c9e5c873e236ad935768da6b24ac3",
"sha256": "ba5990ceca0e9f94819f72121aaee7797e3c3c971b8fc7ddbb530b2097f05fe1"
},
"downloads": -1,
"filename": "nc_py_api-0.18.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "254c9e5c873e236ad935768da6b24ac3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 99361,
"upload_time": "2024-10-09T17:36:21",
"upload_time_iso_8601": "2024-10-09T17:36:21.770702Z",
"url": "https://files.pythonhosted.org/packages/95/f9/304e68d298b54403e16afe9536880abc3c578bc9508737b52d0125abc460/nc_py_api-0.18.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "51f7668ddbcf4764da9b3d6226d726247b010707863293facff88ae2c2504c53",
"md5": "826403cc1da7ed95e2b659c708de449c",
"sha256": "21bfe0503d9c6171ac0f2c46b5ea61861642d05ef8ed797349539b289d539716"
},
"downloads": -1,
"filename": "nc_py_api-0.18.0.tar.gz",
"has_sig": false,
"md5_digest": "826403cc1da7ed95e2b659c708de449c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 78147,
"upload_time": "2024-10-09T17:36:23",
"upload_time_iso_8601": "2024-10-09T17:36:23.440422Z",
"url": "https://files.pythonhosted.org/packages/51/f7/668ddbcf4764da9b3d6226d726247b010707863293facff88ae2c2504c53/nc_py_api-0.18.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 17:36:23",
"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"
}