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 for more information about ownCloud.
Supports connecting to ownCloud 8, 9 and newer.
- retrieve information about ownCloud instance (e.g. version, host, URL, etc.)
- 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
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
- store app data as key/values using the privatedata OCS API
- Python >= 2.7 or Python >= 3.5
- requests module (for making HTTP requests)
Automatic installation with pip:
$ pip install pyocclient
Manual installation of development version with git:
$ pip install requests
$ git clone https://github.com/owncloud/pyocclient.git
$ cd pyocclient
$ python setup.py install
Example for uploading a file then sharing with link:
oc = owncloud.Client('http://domain.tld/owncloud')
link_info = oc.share_file_with_link('testdir/remotefile.txt')
print "Here is your link: " + link_info.get_link()
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:
$ pip install unittest-data-provider
Then run the script “runtests.sh”:
Building the documentation
To build the documentation, you will need to install Sphinx and docutil.
Then run the following commands:
$ 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”.
- 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]
- 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]
- 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]
- Make python egg [PVince81]
- Initial release [PVince81]