Name | pyNextcloud JSON |
Version |
1.0
JSON |
| download |
home_page | None |
Summary | A Python library for interacting with Nextcloud via WebDAV |
upload_time | 2025-02-01 08:23:04 |
maintainer | None |
docs_url | None |
author | Mahir Shah |
requires_python | >=3.6 |
license | MIT |
keywords |
nextcloud
webdav
file-management
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pyNextcloud
`pyNextcloud` is a Python library for interacting with Nextcloud via WebDAV. It provides functions to upload, download, rename, delete files and directories, and check for directory existence.
## Features
- Upload files and folders to Nextcloud
- Download files from Nextcloud
- Rename or move files and directories
- Delete files and directories
- Check if a directory exists
- Configuration using environment variables or a `.env` file
## Installation
To install `pyNextcloud`, use pip:
```bash
pip install pyNextcloud
```
## Configuration
To store the `NEXTCLOUD_URL`, `USERNAME`, and `PASSWORD` securely in your library, you can make use of environment variables or a configuration file to keep them safe and accessible in your app. Here's how you can do both:
### 1. **Using Environment Variables** (Recommended for security)
You can store these sensitive values in environment variables, so they aren't hardcoded in your source code.
#### Steps:
- Set up environment variables on your system or in your deployment environment:
- On Unix/Linux/Mac:
```bash
export NEXTCLOUD_URL="your_nextcloud_url"
export USERNAME="your_username"
export PASSWORD="your_password"
```
- On Windows:
```cmd
set NEXTCLOUD_URL="your_nextcloud_url"
set USERNAME="your_username"
set PASSWORD="your_password"
```
### 2. **Using a Configuration File** (Not as secure as environment variables)
If you'd rather use a configuration file, you can store them in a `.env` or JSON file.
#### `.env` File Example:
- Create a `.env` file:
```
NEXTCLOUD_URL=your_nextcloud_url
USERNAME=your_username
PASSWORD=your_password
```
## Usage
### Upload a File
```python
from pyNextcloud.nextcloud import UploadFile
UploadFile('local_path.txt', 'remote_path.txt')
```
### Download a File
```python
from pyNextcloud.nextcloud import DownloadFile
DownloadFile('local_path.txt', 'remote_path.txt')
```
### Check if a Directory Exists
```python
from pyNextcloud.nextcloud import DirectoryExists_Check
result = DirectoryExists_Check('remote_directory')
print(result)
```
### Create a Directory
```python
from pyNextcloud.nextcloud import CreateDirectory
result = CreateDirectory('new_directory')
print(result)
```
### Rename or Move a File/Directory
```python
from pyNextcloud.nextcloud import RenamePath
result = RenamePath('current_path.txt', 'new_path.txt')
print(result)
```
### Delete a File/Directory
```python
from pyNextcloud.nextcloud import DeletePath
result = DeletePath('target_path.txt')
print(result)
```
### Upload a Folder
```python
from pyNextcloud.nextcloud import UploadFolder
result = UploadFolder('local_folder', 'remote_folder')
print(result)
```
## Running Tests
To run the tests, use the following command:
```bash
python -m unittest discover -s tests
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any changes.
## Acknowledgements
- [Nextcloud](https://nextcloud.com/) for providing the WebDAV interface.
- [Requests](https://docs.python-requests.org/en/master/) for making HTTP requests simple.
- [python-dotenv](https://github.com/theskumar/python-dotenv) for managing environment variables.
Raw data
{
"_id": null,
"home_page": null,
"name": "pyNextcloud",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "nextcloud webdav file-management",
"author": "Mahir Shah",
"author_email": "dev@mahirshah.dev",
"download_url": "https://files.pythonhosted.org/packages/38/3e/077541a5b72f1920696b2466995a58f2c80d7c5efbcb2d4e31355fa53cd7/pynextcloud-1.0.tar.gz",
"platform": null,
"description": "# pyNextcloud\r\n\r\n`pyNextcloud` is a Python library for interacting with Nextcloud via WebDAV. It provides functions to upload, download, rename, delete files and directories, and check for directory existence.\r\n\r\n## Features\r\n\r\n- Upload files and folders to Nextcloud\r\n- Download files from Nextcloud\r\n- Rename or move files and directories\r\n- Delete files and directories\r\n- Check if a directory exists\r\n- Configuration using environment variables or a `.env` file\r\n\r\n## Installation\r\n\r\nTo install `pyNextcloud`, use pip:\r\n\r\n```bash\r\npip install pyNextcloud\r\n```\r\n\r\n## Configuration\r\n\r\nTo store the `NEXTCLOUD_URL`, `USERNAME`, and `PASSWORD` securely in your library, you can make use of environment variables or a configuration file to keep them safe and accessible in your app. Here's how you can do both:\r\n\r\n### 1. **Using Environment Variables** (Recommended for security)\r\n\r\nYou can store these sensitive values in environment variables, so they aren't hardcoded in your source code.\r\n\r\n#### Steps:\r\n\r\n- Set up environment variables on your system or in your deployment environment:\r\n - On Unix/Linux/Mac:\r\n ```bash\r\n export NEXTCLOUD_URL=\"your_nextcloud_url\"\r\n export USERNAME=\"your_username\"\r\n export PASSWORD=\"your_password\"\r\n ```\r\n\r\n - On Windows:\r\n ```cmd\r\n set NEXTCLOUD_URL=\"your_nextcloud_url\"\r\n set USERNAME=\"your_username\"\r\n set PASSWORD=\"your_password\"\r\n ```\r\n\r\n### 2. **Using a Configuration File** (Not as secure as environment variables)\r\n\r\nIf you'd rather use a configuration file, you can store them in a `.env` or JSON file.\r\n\r\n#### `.env` File Example:\r\n\r\n- Create a `.env` file:\r\n ```\r\n NEXTCLOUD_URL=your_nextcloud_url\r\n USERNAME=your_username\r\n PASSWORD=your_password\r\n ```\r\n\r\n## Usage\r\n\r\n### Upload a File\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import UploadFile\r\n\r\nUploadFile('local_path.txt', 'remote_path.txt')\r\n```\r\n\r\n### Download a File\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import DownloadFile\r\n\r\nDownloadFile('local_path.txt', 'remote_path.txt')\r\n```\r\n\r\n### Check if a Directory Exists\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import DirectoryExists_Check\r\n\r\nresult = DirectoryExists_Check('remote_directory')\r\nprint(result)\r\n```\r\n\r\n### Create a Directory\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import CreateDirectory\r\n\r\nresult = CreateDirectory('new_directory')\r\nprint(result)\r\n```\r\n\r\n### Rename or Move a File/Directory\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import RenamePath\r\n\r\nresult = RenamePath('current_path.txt', 'new_path.txt')\r\nprint(result)\r\n```\r\n\r\n### Delete a File/Directory\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import DeletePath\r\n\r\nresult = DeletePath('target_path.txt')\r\nprint(result)\r\n```\r\n\r\n### Upload a Folder\r\n\r\n```python\r\nfrom pyNextcloud.nextcloud import UploadFolder\r\n\r\nresult = UploadFolder('local_folder', 'remote_folder')\r\nprint(result)\r\n```\r\n\r\n## Running Tests\r\n\r\nTo run the tests, use the following command:\r\n\r\n```bash\r\npython -m unittest discover -s tests\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please open an issue or submit a pull request for any changes.\r\n\r\n## Acknowledgements\r\n\r\n- [Nextcloud](https://nextcloud.com/) for providing the WebDAV interface.\r\n- [Requests](https://docs.python-requests.org/en/master/) for making HTTP requests simple.\r\n- [python-dotenv](https://github.com/theskumar/python-dotenv) for managing environment variables.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for interacting with Nextcloud via WebDAV",
"version": "1.0",
"project_urls": null,
"split_keywords": [
"nextcloud",
"webdav",
"file-management"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0c38c5892f56580ff0fdc8671accc21b63c31cb15e1dda74be74aed34f5d64bb",
"md5": "b91c0c86f59ac83c3b35306e8c9e88e7",
"sha256": "12795e36a9d79d49cde2ea2b8ae47e245dd87b63267765abf4cee82b9d9fc63a"
},
"downloads": -1,
"filename": "pyNextcloud-1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b91c0c86f59ac83c3b35306e8c9e88e7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6717,
"upload_time": "2025-02-01T08:23:02",
"upload_time_iso_8601": "2025-02-01T08:23:02.358901Z",
"url": "https://files.pythonhosted.org/packages/0c/38/c5892f56580ff0fdc8671accc21b63c31cb15e1dda74be74aed34f5d64bb/pyNextcloud-1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "383e077541a5b72f1920696b2466995a58f2c80d7c5efbcb2d4e31355fa53cd7",
"md5": "e74f7f221abbb20cae18f2aac17b960d",
"sha256": "f43718da3e744d349a52fe725cf041bf3687677214e051b12b7f67d72bc261eb"
},
"downloads": -1,
"filename": "pynextcloud-1.0.tar.gz",
"has_sig": false,
"md5_digest": "e74f7f221abbb20cae18f2aac17b960d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7353,
"upload_time": "2025-02-01T08:23:04",
"upload_time_iso_8601": "2025-02-01T08:23:04.432377Z",
"url": "https://files.pythonhosted.org/packages/38/3e/077541a5b72f1920696b2466995a58f2c80d7c5efbcb2d4e31355fa53cd7/pynextcloud-1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-01 08:23:04",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pynextcloud"
}