==================================
Python client library for ownCloud
==================================
.. image:: https://travis-ci.org/owncloud/pyocclient.svg?branch=master
:target: https://travis-ci.org/owncloud/pyocclient
This pure python library makes it possible to connect to an ownCloud instance
and perform file, share and attribute operations.
Please note that this is **not** a sync client implementation but a library
that provides functions to abstract away HTTP calls for various ownCloud APIs.
See the `ownCloud homepage <http://owncloud.org>`_ for more information about ownCloud.
Features
========
Supports connecting to ownCloud 8.2, 9.0, 9.1 and newer.
General information
-------------------
- retrieve information about ownCloud instance (e.g. version, host, URL, etc.)
Accessing files
---------------
- basic file operations like getting a directory listing, file upload/download, directory creation, etc
- read/write file contents from strings
- upload with chunking and mtime keeping
- upload whole directories
- directory download as zip
- access files from public links
- upload files to files drop link target
Sharing (OCS Share API)
-----------------------
- share a file/directory via public link
- share a file/directory with another user or group
- unshare a file/directory
- check if a file/directory is already shared
- get information about a shared resource
- update properties of a known share
Apps (OCS Provisioning API)
---------------------------
- enable/disable apps
- retrieve list of enabled apps
Users (OCS Provisioning API)
----------------------------
- create/delete users
- create/delete groups
- add/remove user from groups
App data
--------
- store app data as key/values using the privatedata OCS API
Requirements
============
- Python >= 2.7 or Python >= 3.5
- requests module (for making HTTP requests)
Installation
============
Automatic installation with pip:
.. code-block:: bash
$ pip install pyocclient
Manual installation of development version with git:
.. code-block:: bash
$ pip install requests
$ git clone https://github.com/owncloud/pyocclient.git
$ cd pyocclient
$ python setup.py install
Usage
=====
Example for uploading a file then sharing with link:
.. code-block:: python
import owncloud
oc = owncloud.Client('http://domain.tld/owncloud')
oc.login('user', 'password')
oc.mkdir('testdir')
oc.put_file('testdir/remotefile.txt', 'localfile.txt')
link_info = oc.share_file_with_link('testdir/remotefile.txt')
print "Here is your link: " + link_info.get_link()
Example for uploading a file to a public shared folder:
.. code-block:: python
import owncloud
public_link = 'http://domain.tld/owncloud/A1B2C3D4'
oc = owncloud.Client.from_public_link(public_link)
oc.drop_file('myfile.zip')
Example for downloading a file from a public shared folder with password:
.. code-block:: python
import owncloud
public_link = 'http://domain.tld/owncloud/A1B2C3D4'
folder_password = 'secret'
oc = owncloud.Client.from_public_link(public_link, password=folder_password)
oc.get_file('/sharedfile.zip', 'download/destination/sharedfile.zip')
Running the unit tests
======================
To run the unit tests, create a config file called "owncloud/test/config.py".
There is a config file example called "owncloud/test/config.py.sample". All the
information required is in that file.
It should point to a running ownCloud instance to test against.
You might also need to install the unittest-data-provider package:
.. code-block:: bash
$ pip install unittest-data-provider
Then run the script "runtests.sh":
.. code-block:: bash
$ ./runtests.sh
Building the documentation
==========================
To build the documentation, you will need to install Sphinx and docutil.
Then run the following commands:
.. code-block:: bash
$ sphinx-apidoc -e -f -o docs/source owncloud/ owncloud/test
$ cd docs
$ make html
You can then find the documentation inside of "doc/build/html".
Contributors
============
Contributors
============
* Vincent Petry <pvince81@owncloud.com>
* Steffen Lindner <mail@steffen-lindner.de>
* Soal <soal@soal.pl>
* Bruno Santeramo <bruno.santeramo@gmail.com>
* jennifer <jennifer@owncloud.com>
* Sergio Bertolín <sbertolin@solidgear.es>
* Alessandro Cosentino <cosenal@gmail.com>
* Mike <mike@x220>
* Joas Schilling <nickvergessen@owncloud.com>
* Individual IT Services <info@individual-it.net>
* Juan Pablo Villafáñez <jvillafanez@solidgear.es>
* Simon Vigneux <svigneux@kronostechnologies.com>
* Roeland Jago Douma <rullzer@owncloud.com>
* Erik Pellikka <erik@pellikka.org>
* Florian Zierer <florian.zierer@moticon.de>
* mrwunderbar666 <paul.balluff@gmail.com>
* NikosChondros <n.chondros@di.uoa.gr>
Changelog
=========
0.6
---
- Added support to query arbitrary properties with file info and file listing [NikosChondros]
- Added support for file operations within a public link [mrwunderbar666]
0.5
---
- Added "name" attribute for public links [PVince81]
- Fixed deprecation warnings [Tilman Lüttje] [PVince81]
- Added support sharing with federated users [remjg]
- Fixed setup script for utf-8 paths [amicitas]
- Fixed file mtime parsing issue [viraj96]
- Add support for the server's DAV v2 endpoint [PVince81]
- Remove support for ownCloud 8.1, 9.0 and 9.1 which are EOL [PVince81]
0.4
---
- Some code cleanup removing needless if statements [jamescooke]
- Remove old session_mode [PVince81]
- Set Depth to 0 in file_info call [PVince81]
- Make subclassing of Client event easier with protected methods [bobatsar]
0.3
---
- Make subclassing of Client easier [bobatsar]
- Add Depth param for recursive listing [bobatsar]
- Add shared_with_me parameter to get_shares [bobatsar]
- Link variable is now called url inside of shareinfo [SergioBertolinSG]
- Python3 support [ethifus] [Blizzz]
0.2
---
- Webdav COPY support [individual-it]
- Added API for federated sharing [nickvergessen]
- Fix login issue in case of failed login [individual-it]
- Added function to get capabilities [SergioBertolinSG]
- Added subadmin APIs for provisioning API [svigneux]
- Tests for provisioning API [individual-it]
- Added provisioning API functions [jennifer]
- Code cleanup / PEP8 formatting [jennifer]
- Added status check function [soalhn]
- Added share API functions [soalhn] [SergioBertolinSG]
- Travis integration [Gomez]
- Added session handling workaround for OC 5 [PVince81]
- Fixed many issues related to unicode path names [PVince81]
- Client now works properly on Windows [PVince81]
0.1
---
- Make python egg [PVince81]
- Initial release [PVince81]
Raw data
{
"_id": null,
"home_page": "https://github.com/owncloud/pyocclient/",
"name": "pyocclient",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Vincent Petry",
"author_email": "pvince81@owncloud.com",
"download_url": "https://files.pythonhosted.org/packages/1f/ce/c60f248822f4a4cc922a2766714e884a2eced5d8fc06a26ffe875ae1de09/pyocclient-0.6.tar.gz",
"platform": "",
"description": "==================================\nPython client library for ownCloud\n==================================\n\n.. image:: https://travis-ci.org/owncloud/pyocclient.svg?branch=master\n :target: https://travis-ci.org/owncloud/pyocclient\n\nThis pure python library makes it possible to connect to an ownCloud instance\nand perform file, share and attribute operations.\n\nPlease note that this is **not** a sync client implementation but a library\nthat provides functions to abstract away HTTP calls for various ownCloud APIs.\n\nSee the `ownCloud homepage <http://owncloud.org>`_ for more information about ownCloud.\n\nFeatures\n========\n\nSupports connecting to ownCloud 8.2, 9.0, 9.1 and newer.\n\nGeneral information\n-------------------\n\n- retrieve information about ownCloud instance (e.g. version, host, URL, etc.)\n\nAccessing files\n---------------\n\n- basic file operations like getting a directory listing, file upload/download, directory creation, etc\n- read/write file contents from strings\n- upload with chunking and mtime keeping\n- upload whole directories\n- directory download as zip\n- access files from public links\n- upload files to files drop link target\n\nSharing (OCS Share API)\n-----------------------\n\n- share a file/directory via public link\n- share a file/directory with another user or group\n- unshare a file/directory\n- check if a file/directory is already shared\n- get information about a shared resource\n- update properties of a known share\n\nApps (OCS Provisioning API)\n---------------------------\n\n- enable/disable apps\n- retrieve list of enabled apps\n\nUsers (OCS Provisioning API)\n----------------------------\n\n- create/delete users\n- create/delete groups\n- add/remove user from groups\n\nApp data\n--------\n\n- store app data as key/values using the privatedata OCS API\n\nRequirements\n============\n\n- Python >= 2.7 or Python >= 3.5\n- requests module (for making HTTP requests)\n\nInstallation\n============\n\nAutomatic installation with pip:\n\n.. code-block:: bash\n\n $ pip install pyocclient\n\nManual installation of development version with git:\n\n.. code-block:: bash\n\n $ pip install requests\n $ git clone https://github.com/owncloud/pyocclient.git\n $ cd pyocclient\n $ python setup.py install\n\nUsage\n=====\n\nExample for uploading a file then sharing with link:\n\n.. code-block:: python\n\n import owncloud\n\n oc = owncloud.Client('http://domain.tld/owncloud')\n\n oc.login('user', 'password')\n\n oc.mkdir('testdir')\n\n oc.put_file('testdir/remotefile.txt', 'localfile.txt')\n\n link_info = oc.share_file_with_link('testdir/remotefile.txt')\n\n print \"Here is your link: \" + link_info.get_link()\n\nExample for uploading a file to a public shared folder:\n\n.. code-block:: python\n\n import owncloud\n\n public_link = 'http://domain.tld/owncloud/A1B2C3D4'\n\n oc = owncloud.Client.from_public_link(public_link)\n oc.drop_file('myfile.zip')\n\n\nExample for downloading a file from a public shared folder with password:\n\n.. code-block:: python\n\n import owncloud\n\n public_link = 'http://domain.tld/owncloud/A1B2C3D4'\n folder_password = 'secret'\n\n oc = owncloud.Client.from_public_link(public_link, password=folder_password)\n oc.get_file('/sharedfile.zip', 'download/destination/sharedfile.zip')\n\nRunning the unit tests\n======================\n\nTo run the unit tests, create a config file called \"owncloud/test/config.py\".\nThere is a config file example called \"owncloud/test/config.py.sample\". All the\ninformation required is in that file. \nIt should point to a running ownCloud instance to test against.\n\nYou might also need to install the unittest-data-provider package:\n\n.. code-block:: bash\n\n $ pip install unittest-data-provider\n\nThen run the script \"runtests.sh\":\n\n.. code-block:: bash\n\n $ ./runtests.sh\n\nBuilding the documentation\n==========================\n\nTo build the documentation, you will need to install Sphinx and docutil.\nThen run the following commands:\n\n.. code-block:: bash\n\n $ sphinx-apidoc -e -f -o docs/source owncloud/ owncloud/test\n $ cd docs\n $ make html\n\nYou can then find the documentation inside of \"doc/build/html\".\n\n\nContributors\n============\n\nContributors\n============\n\n* Vincent Petry <pvince81@owncloud.com>\n* Steffen Lindner <mail@steffen-lindner.de>\n* Soal <soal@soal.pl>\n* Bruno Santeramo <bruno.santeramo@gmail.com>\n* jennifer <jennifer@owncloud.com>\n* Sergio Bertol\u00edn <sbertolin@solidgear.es>\n* Alessandro Cosentino <cosenal@gmail.com>\n* Mike <mike@x220>\n* Joas Schilling <nickvergessen@owncloud.com>\n* Individual IT Services <info@individual-it.net>\n* Juan Pablo Villaf\u00e1\u00f1ez <jvillafanez@solidgear.es>\n* Simon Vigneux <svigneux@kronostechnologies.com>\n* Roeland Jago Douma <rullzer@owncloud.com>\n* Erik Pellikka <erik@pellikka.org>\n* Florian Zierer <florian.zierer@moticon.de>\n* mrwunderbar666 <paul.balluff@gmail.com>\n* NikosChondros <n.chondros@di.uoa.gr>\n\nChangelog\n=========\n\n0.6\n---\n\n- Added support to query arbitrary properties with file info and file listing [NikosChondros]\n- Added support for file operations within a public link [mrwunderbar666]\n\n0.5\n---\n\n- Added \"name\" attribute for public links [PVince81]\n- Fixed deprecation warnings [Tilman L\u00fcttje] [PVince81]\n- Added support sharing with federated users [remjg]\n- Fixed setup script for utf-8 paths [amicitas]\n- Fixed file mtime parsing issue [viraj96]\n- Add support for the server's DAV v2 endpoint [PVince81]\n- Remove support for ownCloud 8.1, 9.0 and 9.1 which are EOL [PVince81]\n\n0.4\n---\n\n- Some code cleanup removing needless if statements [jamescooke]\n- Remove old session_mode [PVince81]\n- Set Depth to 0 in file_info call [PVince81]\n- Make subclassing of Client event easier with protected methods [bobatsar]\n\n0.3\n---\n\n- Make subclassing of Client easier [bobatsar]\n- Add Depth param for recursive listing [bobatsar]\n- Add shared_with_me parameter to get_shares [bobatsar]\n- Link variable is now called url inside of shareinfo [SergioBertolinSG]\n- Python3 support [ethifus] [Blizzz]\n\n0.2\n---\n\n- Webdav COPY support [individual-it]\n- Added API for federated sharing [nickvergessen]\n- Fix login issue in case of failed login [individual-it]\n- Added function to get capabilities [SergioBertolinSG]\n- Added subadmin APIs for provisioning API [svigneux]\n- Tests for provisioning API [individual-it]\n- Added provisioning API functions [jennifer]\n- Code cleanup / PEP8 formatting [jennifer]\n- Added status check function [soalhn]\n- Added share API functions [soalhn] [SergioBertolinSG]\n- Travis integration [Gomez]\n- Added session handling workaround for OC 5 [PVince81]\n- Fixed many issues related to unicode path names [PVince81]\n- Client now works properly on Windows [PVince81]\n\n0.1\n---\n\n- Make python egg [PVince81]\n- Initial release [PVince81]\n\n",
"bugtrack_url": null,
"license": "LICENSE.txt",
"summary": "Python client library for ownCloud",
"version": "0.6",
"project_urls": {
"Homepage": "https://github.com/owncloud/pyocclient/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2ea5039870a824dc68c7698d3fcdb00f3d077fea80bc8051476b83efb3bd1bdc",
"md5": "6a423bab1125c1ed7b00030a9a6b46e0",
"sha256": "b9fbe49ed6bf7594dbb3dc0dc477c92204dbd7c0b9495166421e74a96b05735c"
},
"downloads": -1,
"filename": "pyocclient-0.6-py2.7.egg",
"has_sig": false,
"md5_digest": "6a423bab1125c1ed7b00030a9a6b46e0",
"packagetype": "bdist_egg",
"python_version": "2.7",
"requires_python": null,
"size": 58659,
"upload_time": "2020-09-17T12:25:59",
"upload_time_iso_8601": "2020-09-17T12:25:59.566779Z",
"url": "https://files.pythonhosted.org/packages/2e/a5/039870a824dc68c7698d3fcdb00f3d077fea80bc8051476b83efb3bd1bdc/pyocclient-0.6-py2.7.egg",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22194edeb2fc7460052127c3621c2461c0deedc9181e8e9f2f5e331b4d7dc89a",
"md5": "3b35aa0da1b45ab4b3e988f04616085c",
"sha256": "a02151c0435851ca80582731da52c07f23c70b9c2d185c5f87f6e93c5db63dd3"
},
"downloads": -1,
"filename": "pyocclient-0.6-py3.8.egg",
"has_sig": false,
"md5_digest": "3b35aa0da1b45ab4b3e988f04616085c",
"packagetype": "bdist_egg",
"python_version": "3.8",
"requires_python": null,
"size": 59149,
"upload_time": "2020-09-17T12:23:20",
"upload_time_iso_8601": "2020-09-17T12:23:20.445970Z",
"url": "https://files.pythonhosted.org/packages/22/19/4edeb2fc7460052127c3621c2461c0deedc9181e8e9f2f5e331b4d7dc89a/pyocclient-0.6-py3.8.egg",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1fcec60f248822f4a4cc922a2766714e884a2eced5d8fc06a26ffe875ae1de09",
"md5": "b3ee49f25c5d0ef4031c2fd617769b44",
"sha256": "a33ddcbbd2ec22d9bc7d76b71dd77896c557221153d1428759780b5fb8fe8fa3"
},
"downloads": -1,
"filename": "pyocclient-0.6.tar.gz",
"has_sig": false,
"md5_digest": "b3ee49f25c5d0ef4031c2fd617769b44",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28995,
"upload_time": "2020-09-17T12:27:36",
"upload_time_iso_8601": "2020-09-17T12:27:36.779132Z",
"url": "https://files.pythonhosted.org/packages/1f/ce/c60f248822f4a4cc922a2766714e884a2eced5d8fc06a26ffe875ae1de09/pyocclient-0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-09-17 12:27:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "owncloud",
"github_project": "pyocclient",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "pyocclient"
}